Gitlab Commands Posted on October 02, 2020 by Dharmendra Kumar with No comments: When you create any project in Gitlab or Git then you can use below commands using shell/ command prompt to initialise and setup your source/version control First you have to to set it up the user name and login email id. Although when you create your first project in gitlab, you will see the Below commands but if you follow the instructions , you might get errors at some steps, I will provide details for those errors and how to fix those too.Let's follow the below steps.1. Git global setupgit config --global user.name "<Your Name>" git config --global user.email "<your login email >" 2. Create a new repositorygit clone https://gitlab.com/<user_name>/<project name>.git cd <your local project directory> touch README.md git add README.md git commit -m "add README" git push -u origin master3. Push an existing foldercd existing_folder git init git remote add origin https://gitlab.com/<user_name>/<project name>.git git add . git commit -m "Initial commit" git push -u origin master4. Push an existing Git repositorycd existing_repo git remote rename origin old-origin git remote add origin https://gitlab.com/<user_name>/<project name>.git git push -u origin --all git push -u origin --tags So, it might work for you always but for some Step 3 or 2 might throw below error.remote: The project you were looking for could not be found.fatal: repository 'https://gitlab.com/<user name>/<project name>.git/' not foundSo, in order to resolve this, you need to modify the URL. You have to add your username in the domain as well . So it should look like https://<user_name>@gitlab.com/<user_name>/<project name>.git So replace the project URL in step 2, 3 and 4 if it doesn't work with default one. Share: Facebook Twitter Google+ Stumble Digg Email ThisBlogThis!Share to TwitterShare to Facebook
0 comments:
Post a comment