1

I have a merged-remote so that a push goes to both the github server and to a file system folder.

I've added the merged-remote by using:

git remote set-url --add origin "file:////server/folder/myrepo"

The repo's config file then has this in the origin remote section:

[remote "origin"]
    url = http://enterprise/folder/myrepo
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = file:////server/folder/myrepo

I can then use git push to send updates to both our github server and to a file system folder.

However these settings aren't saved to the repo. If I clone the repo back down from github server the config looks like:

[remote "origin"]
        url = http://enterprise/folder/myrepo
        fetch = +refs/heads/*:refs/remotes/origin/*

The second url setting is now gone, and git commit --all doesn't see the config file as something to commit. How do I get this second remote url to save?

klyd
  • 3,939
  • 3
  • 24
  • 34
  • possible duplicate of [Is it possible to clone git config from remote location?](http://stackoverflow.com/questions/6547933/is-it-possible-to-clone-git-config-from-remote-location) – klyd Oct 13 '14 at 15:33

1 Answers1

1

Anything stored in .git/config is purely local, including remote information. Your initial remote isn't stored either; this gets created when you clone, and is based on the URL you used to create your clone.

For more about why .git/config is not shared, see this answer.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • I see, its a security risk to include the config file. I also see that this is a duplicate of a number of questions now. Thanks for the response. – klyd Oct 13 '14 at 15:33