简体   繁体   中英

git-credential-winstore.exe for two GitHub logins?

I use git-credential-winstore (installed with msysgit) to store my personal GitHub account details in Window's credentials store (Control Panel -> User Accounts -> Manage your credentials -> windows credentials) I'm now trying to use a second GitHub account. I've modified the local git.config ( git config user.name "foo" ) but when I push, it's still trying to use the personal GitHub credentials. I know I can change the repository url from https://github.com/user/project.git to https://user:password@github.com/user/project.git , but I'd rather not take the security risk by embedding credentials in the git.config. I know I can go into Control Panel and flip the credentials back and forth, but that's really annoying. Is there a way to store multiple GitHub account details in git-credential-winstore and configure each repo to use one or the other?

I have forked the git-credential-winstore to support multiple github logins. You can find my fork here: https://gitcredentialstore.codeplex.com/SourceControl/network/forks/nickmeldrum/gitcredentialstore

(I have sent the original author a pull request but it doesn't look like he accepts them/ maintains the project anymore.)

The simplest way to use my fork would be:

  1. Clone the repository locally: git clone https://git01.codeplex.com/gitcredentialstore
  2. Build the project using the Debug configuration (should build from scratch with Visual Studio or MSBuild: msbuild.exe .\\git-credential-winstore.sln )
  3. Run the command: InstallLocalBuild.cmd to setup git to use this version of the credential helper

If anyone actually uses this fork and tells me about it, I will set up a proper binary download in codeplex!

Key piece of info:

In order for this to work you need to tell git the username that you want to use to connect to that particular remote in that repo. You do that by specifying it in the remote url. For example:

git remote set-url origin https://username@github.com/username/repository.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM