0

It is possible (via git config --global) to use e.g. custom proxy settings for certain addresses like:

[http "https://github.com/"]
    proxy = http://myproxy.com:80

and you can use custom user.name per repository with

[user]
    name = John

but is it possible to combine these two to have a default user.name for a particular address?

I tried the command

git config --global http."https://foo.bar/".user.name test

but it creates an invalid setting with the user being part of the url.

[http "https://foo.bar/.user"]
   name = test

I'd like to have such a default setting because I don't want to remember to specify the --proxy switch each time I'm cloning a repository and I have a couple of different sources.

t3chb0t
  • 16,340
  • 13
  • 78
  • 118

2 Answers2

1

No, not directly with the standard git config. However you can use some scripts to accomplish this. If you are using linux you can head to this answer.

Git only supports conditional includes, but thats directory based. You can look it up here. This would mean that only the initial clone is manual and after that you can set the correct password for that repository.

Tip: I would suggest SSH keys, this way you don't have to log in and only have to add the ssh key to your account once.

Ron Nabuurs
  • 1,528
  • 11
  • 29
1

you need to write a PAC file for your proxy.

gzh
  • 3,507
  • 2
  • 19
  • 23