Skip to content

Instantly share code, notes, and snippets.

@chalasr
Last active January 8, 2016 12:36
Show Gist options
  • Select an option

  • Save chalasr/9b0d4c587bdbeedf9794 to your computer and use it in GitHub Desktop.

Select an option

Save chalasr/9b0d4c587bdbeedf9794 to your computer and use it in GitHub Desktop.
Multiple remote on git-hosted repository

Assuming you have a repository hosted on git.server1.com and you want push it to another host.
Your remote "origin" is set to git.server1.com:username/repository.git

1- Create an empty repository from github interface

2- Add the "github" remote to your local repository

$ git remote add github [email protected]:username/repository.git

3- Add your previous commits into

$ git add -A
$ git commit -m "message"
$ git push -u github master

Now, use "origin" as the main remote, work on it, and sometimes, to keep your github repo up-to-date, just do:

$ git push github master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment