Michael Wu

The Life of a Cloud Engineer

  • Home
  • Resume
  • Blog
  • Contact

Posted on 02.22.19

How to push an existing repository from VS Code to Azure DevOps by PowerShell

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!

  1. 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!


Categories:PowerShell

Recent Posts

  • Automating Resource Restriction in Azure subscriptions with Budget Alert, Automation Account, and Azure Policy
  • How to configure the Security Center via Azure Resource Manager (ARM) template
  • How to restrict Account Operators to see the password in LAPS
  • How to join a VM to a domain by PowerShell in Azure
  • How to push an existing repository from VS Code to Azure DevOps by PowerShell

Search

Categories

  • Azure
  • IIS
  • PowerShell
  • SCCM
  • VMware
  • Windows Server

Contact

Email: [email protected] | Powered By the 太初網路

Copyright © 2024 mikewu.org Disclaimer

Connect

FacebookTwitterGoogle +Linkedin