简体   繁体   English

两个GitHub登录的git-credential-winstore.exe?

[英]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. 我使用git-credential-winstore (与msysgit 一起安装)在Window的凭证存储中存储我的个人GitHub帐户详细信息(控制面板 - >用户帐户 - >管理您的凭据 - > Windows凭据)我现在尝试使用第二个GitHub帐户。 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. 我已经修改了本地git.config( git config user.name "foo" )但是当我推送时,它仍然试图使用个人GitHub凭据。 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. 我知道我可以将存储库URL从https://github.com/user/project.git更改为https:// user:password@github.com/user/project.git ,但我宁愿不采取安全措施通过在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? 有没有办法在git-credential-winstore中存储多个GitHub帐户详细信息,并将每个repo配置为使用其中一个?

I have forked the git-credential-winstore to support multiple github logins. 我已经分叉了git-credential-winstore来支持多个github登录。 You can find my fork here: https://gitcredentialstore.codeplex.com/SourceControl/network/forks/nickmeldrum/gitcredentialstore 你可以在这里找到我的分支: 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: 使用我的fork最简单的方法是:

  1. Clone the repository locally: git clone https://git01.codeplex.com/gitcredentialstore 在本地克隆存储库: 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 ) 使用Debug配置构建项目(应该使用Visual Studio或MSBuild从头开始构建: msbuild.exe .\\git-credential-winstore.sln
  3. Run the command: InstallLocalBuild.cmd to setup git to use this version of the credential helper 运行命令: InstallLocalBuild.cmd以设置git以使用此版本的凭证帮助程序

If anyone actually uses this fork and tells me about it, I will set up a proper binary download in codeplex! 如果有人真的使用这个fork并告诉我它,我会在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. 为了使其工作,您需要告诉git您要用于连接到该repo中该特定远程的用户名。 You do that by specifying it in the remote url. 您可以通过在远程URL中指定它来实现。 For example: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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