Is it possible to pull from one repo and push to o

2019-01-08 08:52发布

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.

2条回答
小情绪 Triste *
2楼-- · 2019-01-08 09:00

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 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 user@example.com:repo.git
查看更多
唯我独甜
3楼-- · 2019-01-08 09:08

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 ;-)

查看更多
登录 后发表回答