How can I click on one URL and extract from another using one remote?

I created a clone of this repository . If I run the following command, I see that my local repo is configured to use my clone to pull / pull, as expected.

$ git remote show origin * remote origin Fetch URL: https://github.com/domurtag/airbrake-grails.git Push URL: https://github.com/domurtag/airbrake-grails.git 

I would like my local repo to exit the master repo (the one I cloned from) instead, and click on my clone. The first thing I did was add the master repo as remote:

 $ git remote add cavneb https://github.com/cavneb/airbrake-grails.git 

If I run git remote show origin again, I will see the same output, so obviously I need to do something else to indicate that the cavneb repository should be used for extraction, but I'm not sure what it is.

In case this is relevant, I showed the contents of my .git/config below:

 [core] repositoryformatversion = 0 filemode = true logallrefupdates = true [remote "origin"] url = https://github.com/domurtag/airbrake-grails.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [remote "cavneb"] url = https://github.com/cavneb/airbrake-grails.git fetch = +refs/heads/*:refs/remotes/cavneb/* 
+4
source share
3 answers

The command you are looking for is:

 git remote set-url origin https://github.com/cavneb/airbrake-grails.git git remote set-url origin --push https://github.com/domurtag/airbrake-grails.git 

But I would strongly advise doing this. I'm not sure, but I would suggest that this confuses git a lot because git assumes this is the same repo. Therefore, when you click, the result of the next selection should change, which obviously will not.

The right way to handle your situation is to add a master repo as an additional remote (I would call it upstream ), and when you want to pull it out, just do:

 git fetch upstream git merge upstream/master 
+10
source

Git 1.8.3 contains options that help with triangular workflows.

remote.pushdefault : remote access to changes. It can be overridden on a specific branch by setting branch.<branch>.pushremote .

With any configuration, git push (without additional arguments) will be clicked on your preferred remote, rather than the remote branch. See 1.8.3-rc2 for details .

+4
source

Try using set-url with click and click:

 git remote set-url --pull origin https://github.com/domurtag/airbrake-grails.git git remote set-url --push origin https://github.com/cavneb/airbrake-grails.git 
0
source

All Articles