klyd
klyd

Reputation: 3979

How to save config for merged-remotes in a git repository?

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?

Upvotes: 1

Views: 75

Answers (1)

Chris
Chris

Reputation: 136958

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.

Upvotes: 1

Related Questions