0

I've the following git remote configuration in order to push changes to two separate repositories (inspired by pull/push from multiple remote locations):

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@bitbucket.org:sgrodzicki/test.git
    url = git@github.com:sgrodzicki/test.git

This works well until I make a new clone somewhere:

git clone git@bitbucket.org:sgrodzicki/test.git

The clone configuration has only one host:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@bitbucket.org:sgrodzicki/test.git

The same thing with the other repository (GitHub):

git clone git@github.com:sgrodzicki/test.git

Then it looks like this:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@github.com:sgrodzicki/test.git

My question is: how to make these configuration changes visible on both hosts?

Community
  • 1
  • 1
sgrodzicki
  • 1,064
  • 8
  • 6

1 Answers1

1

The configuration of your remotes isn't part of the information that's cloned - like many things in your git directory, it's considered private information.

You just have to do something like the following in each repository:

git remote set-url --add origin git@github.com:sgrodzicki/test.git

... after cloning.

Mark Longair
  • 446,582
  • 72
  • 411
  • 327