Azure Repos is a set of version control tools that you can use to manage your code. Whether your software project is large or small, using version control as soon as possible is a good idea. Version control systems are software that helps you track changes you make in your code over time.
Things we will cover in this post:
- Create a Project in Azure DevOps
- Push our Code to the Azure Repo
Things we will not cover:
- Azure DevOps Services features and Pricing – It is free to use for Individuals. To know more about the services and pricing, visit here.
- Features of Azure Repo – To learn more about its features, visit here. The most important thing is, it provides unlimited private git repositories.
- Azure DevOps Account
Eclipse download link can be found in downloads page.
Create Project in Azure DevOps
First, we need to create a project, then only we can create a repo. There can be multiple repos in a single project. After you log in to Azure DevOps, select your Organization. The organization is auto-created when you sign up. You can also create more organizations.
A single Organization can have multiple projects and a single project can have multiple repos. I have created two organizations. One of them is created by default.
If you are coming for the first time to this portal, you will be asked to create a new project on the home screen. For returning users, you will see your projects listed.
Give a name for your project, select the visibility and create the project. When the project is created, you will land up in a similar dashboard as below.
In the left side menu, click on Repos. A default repository is auto-created, you can select from the top menu. Once you select, it will give instructions to Push existing repos or import a repo or clone.
It says, your repo is empty.
Now let us go ahead and add some code.
Push your Code to the Azure Repo
I hope you have the project or code changes ready in the Eclipse to be pushed to the Azure Repo. You will have a similar project structure like this.
If you have read my post on Push your Code to Azure DevOps Repository using Command Line, you might be knowing that here also we will be following the same approach. The only change will be, here we will be following it visually with User Interface.
Right click on the project folder, select Team -> Share Project.
Select the checkbox “Use or create repository in parent folder of project”.
Under project, trying selecting the checkbox, it will give a warning message. Below it will ask to create repository.
Now the project will get selected. Click on finish.
On the project folder, you will see a yellow-orange cylinder is shown. This symbolizes that your local git repository is created. The next task is to connect this local git repo to the remote repo.
Right-click on the project folder and hover over Team. You will see that various Source control options are shown such as commit, stashes, pull, synchronize, etc.
Select Commit for now. This will open a Git Staging window. Initially, changes are in Unstaged Changes. This has to be moved to Staged changes before Commit.
Select all files or add individual files.
Give a commit message and author & committer details. Click on Commit and Push.
Paste the Azure Repository URI. The host and repository path will be auto-populated. If the Azure repo is private, provide the username and password in the required fields. Before giving creds, you will first have to generate git credentials in Azure DevOps.
Choose the branch you want to push your changes to. The master branch is automatically populated. Click Next. You may be asked to login to Azure DevOps, give the username password generated from Azure Repo.
Finally, click on Finish.
If changes are pushed to Azure Repo successfully, you will see below window.
Cross check your Azure repo for the changes.
Till now we have pushed the initial commit. Let us try changing some code and then push it. When you make any changes to the file, a greater than (>) symbol will be shown in front of the file. This represents that some changes are not staged.
When you move the changes from Unstaged to Staged state, the greater than symbol changes to black star.
And finally when you commit the change, the initial yellow-orange cylinder is shown.
On the Push to the upstream window, it asks to configure just incase you want to change some settings.
This completes our post where we saw how to push your changes to the Azure DevOps Repo from Eclipse.