Problem
How to set up Azure DevOps for Git Version Control?
Solution
Define Project
- Login to https://dev.azure.com or sign up
- Click “New Project” to create a new project. Set the visibility to Private (if needed)
- You will have a project tile as below
![](http://data-engineer.net/wp-content/uploads/2020/01/image-3.png)
Set up File Repo
- Go to a project’s page and navigate to “Repos/Files” section
![devops-2.png](https://ucg1.sharepoint.com/sites/bi/SiteAssets/Finance%20DW%20Documentation/Azure%20DevOps%20Procedure/devops-2.png)
- The Repo could be used to store any file. Including VS projects, SSMS project, Power BI files or any other file.
- If you are starting a blank project (e.g. a new project in VS), click on “Clone in VS code” and continue the set up in VS
- If you want to add an existing folder containing an existing project (in VS or else) or any file, follow these steps:
- Install Git for Windows https://git-scm.com/download/win
- Create a new folder for the project. Like C:\Test\
- Run Git Bash software
- Navigate to C:\Test
![](http://data-engineer.net/wp-content/uploads/2020/01/image-4.png)
- Copy the clone address from DevOps
![](http://data-engineer.net/wp-content/uploads/2020/01/image-5.png)
- Run the command “git clone <clone_address>
![](http://data-engineer.net/wp-content/uploads/2020/01/image-6.png)
- Now copy your existing files (it doesn’t matter what they are) to C:\Test\
![](http://data-engineer.net/wp-content/uploads/2020/01/image-7.png)
- Open Git GUI
![](http://data-engineer.net/wp-content/uploads/2020/01/image-8.png)
- Select “Open Existing Repo” and select “C:\Test”
- Type a commit message and press “Commit”
![](http://data-engineer.net/wp-content/uploads/2020/01/image-9.png)
- Click Push. Select the desired branch and then “Push” again
![devops-9.png](https://ucg1.sharepoint.com/sites/bi/SiteAssets/Finance%20DW%20Documentation/Azure%20DevOps%20Procedure/devops-9.png)
- If the Push is successful, refresh Azure Devop’s webpage in Repos/Files and you will see the files there
![](http://data-engineer.net/wp-content/uploads/2020/01/image-10-1024x274.png)
- You can use Git GUI to manage your project’s version control.
Version Control through VS
If you are working on a VS solution and need to do the version control, do the following
- Connect to the Git Repo by going to Team Explorer/Connect. You need cloning url to be able to connect
![](http://data-engineer.net/wp-content/uploads/2020/01/image-11.png)
- Click on the drop down at the top of Team Explorer
![](http://data-engineer.net/wp-content/uploads/2020/01/image-12.png)
- Now you can:
- Commit changes (Changes option)
- Create/switch branches (Branches option)
- Sync/Push/Pull (Sync option)