I have been using Git for a while. In the beginning, I copied the codes to the Azure DevOps via browser then cloned them to computers. Never have problems. Recently, I was preparing a presentation about version control to the team. I want to show the team how to push a local repo to the Azure DevOps.
I was stuck as I was thinking the push would create a new repo in the Azure DevOps. All articles and training courses I found showed how to clone them to computers but none of them showing push from a local repo. I finally figured it out and want to share with you the steps!
- In the local computer, create a folder where you will save the codes. You can also create a file but it is optional.
mkdir TestRepo New-Item -Type File .\TestRepo\test.ps1
2. Run the following commands to get the local repo ready
git init git add . git commit -m "add a new file"
3. Go to the Azure DevOp site
4. Create a New Repository (ya…you need to pre-create a repo then push to it)
5. Copy the command line under “push an existing repository from command line”
6. Go to VS Code. Paste the commands and run. Done!