Reputation: 1411
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.
Upvotes: 74
Views: 42016
Reputation: 11
of course! Just get in .git folder and open config file, then edit it, as bellow:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[submodule]
active = .
[remote "remoteA"]
url = https://github.com/userA/repoX.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "remoteB"]
url = https://github.com/userB/repoX.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[pull]
ff = only
rebase = true
after this, you can run the following commands as you wish:
> git pull remoteA [branch_nameX]
> git push remoteB [branch_nameY]
Upvotes: 1
Reputation: 117949
Set a push URL for the remote that is different from the pull URL:
git remote set-url --push origin [email protected]:repo.git
This changes the remote.name.pushurl
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 [email protected]:repo.git
Upvotes: 115
Reputation: 21690
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 ;-)
Upvotes: 24