Multiple urls for remotes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was surprised to figure out that urls/pushurls set up for remotes can
be set multiple times, and that those urls end up being used
sequentially.

Sadly, this has the side effect that one cannot override the config from
the command line, as the url is then added as an extra url, which is
tried after the already configured one.

e.g.
    git -c remote.origin.url=/tmp/foo push origin

will keep pushing to wherever the .git/config's remote.origin.url points
to.

With all the configuration items that work this way, it's actually kind
of sad that it's not possible to force the value from the command line to
override anything that is set in the configuration.

It's worth noting that the documentation for -c says:

    Pass a configuration parameter to the command. The value given will
    override values from configuration files.

... which implies -c remote.origin.url=/tmp/foo should, in fact, replace
any other value already set.

Coming back to the fact that remote.origin.url and remote.origin.pushurl
can actually have multiple values, it's also worth noting that none of
the git-config, git-fetch or git-push documentation seem to say anything
about the fact there can be multiple values.

The git-config documentation says:
   remote.<name>.url
       The URL of a remote repository. See git-fetch(1) or git-push(1).

   remote.<name>.pushurl
       The push URL of a remote repository. See git-push(1).

The git-fetch and git-push documentations always talk about _the_ URL.

The only thing that seems to be talking about this is the documentation
for git-remote, which has --add for set-url. There doesn't seem to be any
documentation about what conditions are required for the non-primary URL
to be used.

Mike



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux