My Brain Cells

Easiest (and best) learning materials for anyone with a curiosity for machine learning and artificial intelligence, Deep learning, Programming, and other fun life hacks.

Azure DevOps: A Step-by-Step Guide to Uploading Your Code with Git

Azure DevOps is a comprehensive cloud-based platform that provides a variety of tools and services for managing and delivering software projects. One of the essential features of Azure DevOps is the integration with Git, which enables developers to manage code repositories and collaborate with team members.

In this article, we will walk you through the process of uploading code to Azure DevOps using Git in VS Code and pushing it to the Azure cloud.

Step 1: Configure Git in VS Code

  1. Install Git: Download and install Git from the official Git website.
  2. Open Visual Studio Code: Open VS Code.
  3. Install Git extension: Go to the Extensions panel, search for the Git extension, and install it.
  4. Configure Git: Go to the Git tab in the left-hand side panel, click on the gear icon, and configure Git with your name, email address, and default branch name:
git config --global "Your Name"
git config --global ""
git config --global init.defaultBranch main

NOTE: if you don’t have a project or a repository then follow step 2 or else you can skip it.

Step 2: Create a Git repository in Azure DevOps

  1. Sign in to Azure DevOps: Go to the Azure DevOps website and sign in to your account.
  2. Create a project: Create a new project or select an existing one:
az devops project create --name "Project Name" --visibility private
  1. Create a repository: Click on the Repos tab in the left-hand side panel and click on the New repository button. Enter a name for your repository and click on Create:
az repos create --name "Repository Name" --project "Project Name"

Step 3: Clone the Git repository in VS Code

  1. Open Visual Studio Code: Open VS Code.
  2. Clone repository: Click on the Clone Repository button and select the Git repository you created in Azure DevOps:
git clone https://[username]@[devops_url]/[project]/_git/[repository_name]

Step 4: Create a new branch

It’s always a good practice to create a new branch before making any changes to the code. To create a new branch, type the following command:

git branch [branch_name]

Replace [branch_name] with the name of your new branch. This command creates a new branch, but you’re still on the main branch. To switch to the new branch, type the following command:

git checkout [branck_name]

This command switches your current branch to the new branch.

Step 5: Write your code & Stage and commit

Once you have cloned the repository, you can start writing your code in VS Code.

Step 5: Stage and commit your changes

  1. Stage changes: Click on the Source Control icon in the left-hand side panel and select the files you want to stage by clicking on the “+” icon:
git add .
  1. Commit changes: Once you have staged your changes, enter a commit message and click on the checkmark icon to commit your changes:
git commit -m "your commit message"

Step 6: Push your changes to Azure DevOps

  1. Push changes: Click on the Synchronize Changes button in the Source Control panel to push your changes to Azure DevOps:
git push --set-upstream origin [branch_name]
  1. Verify changes: Once the push is complete, navigate to the Repos tab in Azure DevOps and verify that your changes are visible in the repository.


By following these step-wise commands, you can easily upload your code to Azure DevOps using Git in VS Code and push it to the Azure cloud.


Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top