简体   繁体   English

Intellij / Pycharm:推送到私有远程github存储库时凭据不匹配

[英]Intellij / Pycharm: Credentials mismatch while pushing to private remote github repo

I have two accounts on github: account1 and account2 . 我在github上有两个帐户: account1account2

I am trying to push to a private remote repo ( repo2 ) on github that has write access for account2 . 我试图在github上推送到具有account2写入权限的私有远程account2repo2 )。 However, I keep getting the error message: Failed with Error: repository 'remote@github.com' not found . 但是,我不断收到错误消息: Failed with Error: repository 'remote@github.com' not found

This is because it is not able to authenticate the credentials for account2 . 这是因为它无法认证account2的凭据。 I am able to push fine through commandline: git push https://account2:password@github.com/repo master 我能够通过命令行进行精细git push https://account2:password@github.com/repo mastergit push https://account2:password@github.com/repo master

If I do the same thing of account1 for a repository ( repo1 ) that has write access for account1 then everything works fine. 如果我做同样的事情account1对储存( repo1有写访问) account1然后一切工作正常。 Interestingly, if I give write access to account1 on repo2 , then also push goes through. 有趣的是,如果我给repo2上的account1授予写访问权,那么推送也会通过。 This means, pycharm has somehow hardwired account1 credentials in it. 这意味着pycharm在某种程度上具有硬连接的 account1凭据。

  • The username-password in preferences in pycharm is set to account2 . pycharm中首选项中的用户名密码设置为account2
  • I found this blog post: http://danielhnyk.cz/pycharm-error-fatal-could-not-read-remote-repository/ , that suggests that for remote push/pull pycharm uses the default ssh credentials isa_pub . 我发现了此博客文章: http ://danielhnyk.cz/pycharm-error-fatal-could-not-read-remote-repository/,这表明对于远程push / pull pycharm使用默认的ssh凭证isa_pub I tried replacing the default isa_pub with the ssh-key for account2 , but that also didn't help. 我尝试用isa_pub的ssh-key替换默认的account2 ,但这也无济于事。

tl;dr Question: Two github accounts, two different private repos. tl; dr问题:两个github帐户,两个不同的私人仓库。 How do I configure pycharm to use repo specific user credentials to allow remote push/pull? 如何配置pycharm以使用特定于回购协议的用户凭据来允许远程推/拉?

Using pycharm 2016.3.2 on OS XY 10.10.4 在OS XY 10.10.4上使用pycharm 2016.3.2

In Addition: account1 doesn't even have a ssh authentication setup with github, still pycharm defaults to use credentials for account1 另外: account1甚至没有使用github进行ssh身份验证的设置,仍然pycharm默认使用account1凭据

Seems what you need here is support of several GitHub accounts, which is not possible atm https://youtrack.jetbrains.com/issue/IDEA-82222 似乎您在这里需要的是对多个GitHub帐户的支持,这在atm https://youtrack.jetbrains.com/issue/IDEA-82222上是不可能的

If you just want to change one account to another, note, that IDE replies on the command line git client. 如果只想将一个帐户更改为另一个帐户,请注意,IDE会在命令行git客户端上进行回复。 It seems like command line git client cached credentials on its own and uses accoutn1 for all connections to GitHub. 似乎命令行git客户端自己缓存了凭据,并使用accoutn1进行到GitHub的所有连接。 You could try totally disabling git credential helper on the repository and check if the issue stays. 您可以尝试在存储库上完全禁用git凭证帮助器,然后检查问题是否仍然存在。

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

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