How to move a Git repo from one developer to another

Rob Pope
2 min readAug 28, 2017

For one reason or another, it’s a fairly common scenario for an organization to need to move developers. Often this transition is well organized, other times a zip file with no instruction turns up in your email. We want to try and preserve as much information as possible for the new developers to start work on this project.

The Transfer

The two largest cloud git providers Bitbucket and Github offer options to transfer the ownership of repositories. This is by far the easiest way and preserves the git branch structure.

This usually involves the old and new developers being in communication. But from my experience most tech people just want to get the job done and are “reasonably” helpful.

The Zip file way

Sometimes a zip file turns up where the previous developer has zipped up their project, git files and all and sent it your way.

For this we need to break out a bit of basic command line git. These steps presumed you have git accessible from the CLI.

  1. Create a remote repo in cloud git provider as normal. Make a note of the remote path.

It’ll be something like:

https://github.com/dogtownmedia/myproject

or

git@github.com:dogtownmedia/myproject.git

Depending on whether you connect via SSH or HTTPS.

2. Unzip the project and use the command line to navigate to the unzipped folder.

cd myproject

3. Add the remote (your remote github repo noted in step 1). We’re going to temporarily give is an alias of “new-origin”.

git remote add new-origin git@github.com:user/repo.git

4. We then push the code to our git server.

git push --all new-origin

5. With the code safely on the server we can remove the old remote repository and rename our alias.

git remote rm origin

git remote rename new-origin origin

--

--