Is it possible to pull from one repo and push to other one?
GitRepositoryGit Problem Overview
I have one repo in github which is public, there I have an Open source application i'm working on that is for making product catalogs, and small cms content.
I also have a private repository (not hosted in github) which is an application developed under the open source application hosted in github.
Since I'm currently working on both applications, adding features in the open source one and also making changes in the private one like changing the template and also pulling the code from the open source one.
I was wondering if there is any way in which I could pull the new stuff from the open source one but also pushing the code of the new application to the other repo.
Git Solutions
Solution 1 - Git
Set a push URL for the remote that is different from the pull URL:
git remote set-url --push origin user@example.com:repo.git
This changes the http://www.kernel.org/pub/software/scm/git/docs/git-push.html#_named_remote_in_configuration_file">remote.<i>name</i>.<b>pushurl</b></a></code> configuration setting. Then
git pull
will pull from the original clone URL but git push
will push to the other.
In old Git versions, git remote set-url
did not have the --push
switch. Without it, you have to do this by changing the configuration setting manually:
git config remote.origin.pushurl user@example.com:repo.git
Solution 2 - Git
git pull private master
and git push github master
pulls from your private repo (given it's named like that) and pushes to github (might also be called origin
). It's not SVN ;-)