Lab 1: Project Setup and Repository Creation
- Create a new Azure DevOps project.
- Set up a Git repository within the project.
- Clone the repository to your local machine and make a simple code change.
I will not be adding minute details here and will try to keep it modest. Will add required details, If something complex.
Steps:
- Create a New Azure DevOps Project
Log in to Azure DevOps: Go to the Azure DevOps portal (https://dev.azure.com/) and log in with your Microsoft account or organizational account.
Create a New Project.
Choose whether its Private or Public
Configure Version Control -> Choose Git
2. Set up a Git repository within the project.
Go to Project
Click on Repos
Initialize repo
3. Clone the Repository and Make a Code Change
Navigate to a directory in your local machine
git clone <repository-url>
cd <repository-name>
git add . (This will add all files in the directory for commit) , If single file we can simply put “ git add filename”
git commit -m "Made a simple code change"
git push origin main
Once you do ‘push’ everything will be pushed to the repository.I f need to bring anything to local directory from repo, we can simply pull using command “git pull”. This will bring everything from repo to local directory.
if you need to pull a specific file, we can run command “git pull origin main — path/to/your/file.txt“
Lets say you are working on a branch rather than your main repository
git clone -b branch1
cd <repository-name>
git add and git commit doesn’t require any mention as you are in the directory
git push origin branch1
NOTE:
To perform git operations, you need to create a Personal Access Token (PAT) and keep the token. Authenticate with your ADO(Azure Devops) from your local directory using the PAT. Remember to give appropriate permission for the type of action you will perform with the token.