This is part one of a three part blog series that I will be writing around setting up Azure DevOps, combined with VS Code and GIT for IT pro’s. As I couldn’t find reference documentation for this, I decided to put this blog together in order to help people get off the ground. Part 1 will detail the setup and integration of GIT, VS Code and Azure DevOps.
Creating A Project in Azure DevOps
There are many tutorials on the web for how to configure your Azure DevOps organisation and first project. For the sake of this example, i’ll be creating a simple project which will be used throughout.
GIT Is the default and recommended Version control. From my experience, the GIT protocol works better for IaaS based DevOps projects. Once you create your project, you will see an empty repository which doesn’t have any code, repositories or much of anything in there.
We want to change this by adding some source code, to do this you’ll need to install VS Code and GIT locally on your machine.
Visual Studio Code
Again, there are many articles showing in detail how to install VS Code. As a reference you can start here https://code.visualstudio.com/docs/setup/windows
I would recommend that you install the following extensions. These will help you with any IT pro activities when working on projects
Azure Repos: https://marketplace.visualstudio.com/items?itemName=ms-vsts.team (This extension allows you to connect to Azure DevOps Services and Team Foundation Server)
Azure Resource Manager Tools: https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools (Currently in preview)
GIT lens: https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens (It helps you to visualize code authorship at a glance via Git blame annotations and code lens)
Installing GIT for Windows
At the time of writing i’ll be installing GIT for Windows version 2.19.2, which can be found here https://git-scm.com/download/win . Once you have the installation up and running, un-check “Associate .git* configuration files with the default text editor” and “Associate .sh files to be run with bash”
On the next screen, select VS Code as the default editor
Followed by “Use GIT from the Windows Command Prompt”
Ensure “Use the native Windows Secure Channel Library” is checked
Then “Checkout Windows-Style, commit Unix-style line endings” is selected
Select “Use Windows default console window”
I would suggest leaving symbolic links off due to the permissions that are required. It’s likely that you won’t be running GIT as an admin so don’t enable it! In terms of the GIT credential manager, you will need this ticked for Azure DevOps. “The Git Credential Manager for Windows (GCM) provides secure Git credential storage for Windows. More information can be found here https://github.com/Microsoft/Git-Credential-Manager-for-Windows
NOTE: If you are working with an authenticated proxy, you may need to setup the following https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Configuration.md
Creating Your local GIT repository
Next you will need to create a repository locally on your machine. I would suggest that you stay away from storing your repository on a OneDrive folder and also try to keep the folder structure as small as possible. Here i’ve created the following folder structure “\source\repos” in my home folder
To launch VS code from your new GIT repository, open PowerShell and CD to your “\source\repos” directory. Run “code . ” an this will open VS Code from your directory
Next we want to sync the repo to the Azure DevOps repository. To do this, we need to head back to our Azure DevOps project and obtain the HTTPS push command as per the following screenshot.
Once you have the GIT Push command, amend the below “git remote add origin” script and run the below in PowerShell.
The next step will be to add a file into your local GIT repository before syncing to your Azure DevOps repository.
That’s it for now, in the next posts I will run through working with branches, artifacts, pipelines, PowerShell and other useful topics. I hope this was useful, please let me know in the comments section below.