Hi,
Currently when I push to Microsoft github projects, I want to use Microsoft github account.
When I use my personal github projects, I want to user Personal github account.
Is there anyway I can configure multiple accounts? If yes, let us know
If not, guide us how we can add this functionality or some way to solve this problem
You can set the credential.useHttpPath property to true via git config --global credential.useHttpPath true and that should take the path into consideration.
I am having the same trouble, I have already set the configuration option. I don't think GCMW is looking at the same git config file (in my msys64 installation) because I just tried to turn GCMW logging on but I can't see it writing any log files to the repo's .git folder.
How does GCMW read git config, can I debug this somehow?
(I have only one git on my path, in c:\msys64\usr\bin, and git otherwise works flawlessly from visual studio, cmd.exe, msys2 shell, and git extensions).
Ah, I worked it out by looking at the source code - to fix it I made a symlink
C:\Users\<my user>\.gitconfig -> c:\msys64\home\<my user>\.gitconfig
Now everything is happy and I am happy :D
I wonder if it wouldn't be a wise feature to fall back to parsing git config --global --list and/or git config --list if the config file could not be found on the disk to parse directly? It certainly would have saved me a lot of headache.
I wonder if it wouldn't be a wise feature to fall back to parsing git config --global --list and/or git config --list if the config file could not be found on the disk to parse directly? It certainly would have saved me a lot of headache.
I've tried _not_ to rely on git.exe from inside git-credential-manager.exe because we've already got git.exe -> git-remote-https.exe -> sh.exe -> git-credential-manager.exe, adding another layer of git.exe just seems "_mean_".
Ah, I worked it out by looking at the source code - to fix it I made a symlink
Thanks for that - I've filed a new issue #256 to track this enhancement / fix.
@nigurr is there any chance you're having an issue similar to @wayneuroda and not realizing it?
@whoisj I am yet to try with your recommendation. will update once I try it out.
Adding the "help wanted" label, as I'm honestly not sure how best to accomplish this.
I did some R&D with the username@domain format in URLs, but it gets confused when 'store' is called.
Needs something that is per remote, but doesn't require onerous amounts of setup.
@whoisj even I have gone through the code base to figure out. Since we are using Single Credential Manager, it wouldn't be easy to hack. GitManager might need to support multiple credentials.
GitManager might need to support multiple credentials.
Can you elaborate on this?
Basically we are using PersonalAccessTokenStore to exposes single Credential. But the target URI is same for single Github repository, cloned by different users
@whoisj I couldn't think of proper solution to get this functionality done.
Ex:
My global .gitconfig has MSFT account.
But when I clone my own project/some other open source project, I need to tell git-cred-manager to use my personal git account and invoke respective credential further down.
But when I clone my own project/some other open source project, I need to tell git-cred-manager to use my personal git account and invoke respective credential further down.
I believe the "correct" solution would be if Git reported the username separately from the userinfo when the <userinfo>@<url> format is used to describe the "fetch" and/or "push" values of the remote.
This would require a change to Git prior to the GCM. Got time and willingness to contribute to Git? :wink:
@whoisj I wish I could write old school C code ;)
How about we maintain this information/mapping in some file and use it to refer to which account should be used for which repo.
The issue here isn't about per repo, because we can resolve that with remote URL + path to the repo. The issue is with more multiple remotes per repo to the same host, or multiple clones of the same repo in the same system.
I can code C happily, so I can do the work. It's time and availability which are the constraints on me. I'll see what I can cook up, just please be patient. :smile:
@whoisj May be we should plan for full fledged SSH support. That would be easier to read the .ssh\config and understand which key to use and work on? just throwing ideas ;)
May be we should plan for full fledged SSH support.
I've added GIT_ASKPASS support, which will work for SSH when you're not using the command line. Sadly, OpenSSH (the SSH implementation that Git for Windows uses) only looks for 'ASKPASS' support when standard input isn't available.
Most helpful comment
You can set the
credential.useHttpPathproperty totrueviagit config --global credential.useHttpPath trueand that should take the path into consideration.