Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

repository

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.

like image 891
chopi321 Avatar asked Dec 24 '10 00:12

chopi321


People also ask

How do I push changes from one repo to another?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

Can I clone a repo into another?

Just for the record, you can clone a git repo within another one: Everything under your lib directory will be ignored by the enclosing Git repo, because said lib directory contains a . git . That means cloning the enclosing repo, and you will get an empty " lib/ " folder.


1 Answers

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
like image 169
Aristotle Pagaltzis Avatar answered Nov 07 '22 03:11

Aristotle Pagaltzis