Move Git Repositories From One To Another Organization In Azure DevOps


For this topic, I strongly believe that there is no need for an introduction as you already know what Git and Azure DevOps are, and I am guessing that you need to move your codebase or repositories from one of your organizations to another. That is the reason why you are here. I believe that there is no direct way of achieving this, there may be some paid tools that do the tricks, but I didn’t want to pay anything for this small requirement. So let’s just see how I achieved this. Trust me this is not as tough a task as it sounds.


I was working on a project and my customer wanted to move the repositories to their Azure DevOps from ours. So before I do it directly with their DevOps, I wanted to try this out. So I created my own Azure DevOps and moved a sample repository to there from my company Azure DevOps.

Move Repositories to Another Organization’s DevOps

Add a User to Both Organizations

To start doing this process, you should add a user to both projects. I created a sample user ([email protected]) and assigned the contributor access to the two repositories. If you don’t have permission to do so, please contact your project administrator and get it done. Once that is done, you can download all the codes from your Source Organization repository. To do that it is a good idea to use an SSH connection.

Configure SSH Key

To create one generate the RSA key pair by running the ssh-keygen command.


Generate SSH Keys

Update the SSH Key in Source DevOps and Clone the Repository

Now go to your source organization and add the Public Key Data under the SSH public keys section. You can find this public key in the. ssh folder.

Public Key in SSH Folder.png

Let’s add a new SSH key now.

Public Key

Add a new SSH Key

Now we can get the SSH clone URL and clone our repository.

Clone Repository Using SSH

You should get a result as in the preceding image if everything is correct.

Clone Repository

Clone Result

Check out all the Branches and Tags

Now let us just go inside the cloned project and make sure all the branches are available by running git branch -a.

Git branch all

Now it is time to check out all the branches locally so that they can be pushed to our new Organization DevOps. This is really important if you need those branches.

Git branch

Check out all the branches

Now fetch all of your tags too by running git fetch --tags. Once that is done you can verify once again whether all the branches are downloaded locally or not.

Update the SSH Key in the Destination DevOps

Follow the same procedure as you did for the source DevOps and update the SSH public key there.

Destination DevOps SSH

Remove Old and Add New Origin

Now comes the important step. Here we are removing the old Origin and adding our new Origin so that we can push all our changes including the branches and tags. So we are going to run the below commands one by one.

# Remove the existing remote named 'origin'
git remote rm origin

# Add a new remote named 'origin'
git remote add origin [remote_repository_url]

# Push all branches to the remote 'origin'
git push origin --all

# Push all tags to the remote 'origin'
git push --tags

 New Origin

Remove Old and Add New Origin

As you can see in the above image, all of our codebases have now been uploaded to the new Azure DevOps. I told you already it is not as hard as it sounds.

Azure DevOps

All the branches in the new DevOps

One thing to notice here is that the new repository will contain your branch history too.

New repository

History of the branches


Thanks a lot for reading this article. I hope now you have learned about

  • the basic git commands
  • how to configure SSH connection in Azure DevOps
  • how to push the repositories to another DevOps

If you have learned anything else from this article, please let me know in the comment section.

Follow me

If you like this article, consider following me!

Your turn. What do you think?

Thanks a lot for reading. Did I miss anything that you may think is needed in this article? Did you find this post useful? Kindly do not forget to share your feedback.

Kindest Regards

Sibeesh Venu