- français
- English
Can I also host my repository at other providers?
Yes, git is a decentralized system, you can host your repository at several providers, you just have to add a remote.
The git remote -v command shows your repository remotes :
$ git remote -v
origin https://user@git.epfl.ch/repo/repository.git (fetch)
origin https://user@git.epfl.ch/repo/repository.git (push)
If you also want to host your repository at another provider (in this example github, but there are also free alternatives like bitbucket), use the following command :
$ git remote add github <url>
<url> being your repository URL on github, e.g. :
$ git remote add github https://user@github.com/user/repository.git
The git remote -v command now shows you the 2 remotes :
$ git remote -v
github https://user@github.com/user/repository.git (fetch)
github https://user@github.com/user/repository.git (push)
origin https://user@git.epfl.ch/repo/repository.git (fetch)
origin https://user@git.epfl.ch/repo/repository.git (push)
You can now push your repository to github :
$ git push -u github master
For more clarity, rename the origin remote (the default name) to epfl :
$ git remote rename origin epfl
The git remote -v command shows you the change :
$ git remote -v
github https://user@github.com/user/repository.git (fetch)
github https://user@github.com/user/repository.git (push)
epfl https://user@git.epfl.ch/repo/repository.git (fetch)
epfl https://user@git.epfl.ch/repo/repository.git (push)
Beware! To push your changes you must now do it on the 2 remotes separately :
$ git push epfl
$ git push github