Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
497 views
in Technique[技术] by (71.8m points)

git - Is it possible to pull from one repo and push to other one?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...