使用 SSH 执行推送时,Git Bash 要求提供我的用户凭据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5965859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git Bash asking for my user credentials when performing a push using SSH
提问by user32585
I have created and successfully implemented a Git project on the Codaset website. I am using SSH to communicate between my Codaset and my local repository. When I do a push from Git Bash, Git Bash asks me for my user name credentials. Although, Git Bash performs the push successfully, it is tedious to having to enter my user credentials every time I perform a push.
我已经在 Codaset 网站上创建并成功实施了一个 Git 项目。我正在使用 SSH 在我的 Codaset 和我的本地存储库之间进行通信。当我从 Git Bash 推送时,Git Bash 会询问我的用户名凭据。尽管 Git Bash 成功执行了推送,但每次执行推送时都必须输入我的用户凭据很乏味。
I have checked out many blogs and suggestions to fix this problem, but to no avail. Also, I have tried to use PuTTY. My questions are:
我查看了许多博客和建议来解决这个问题,但都无济于事。另外,我尝试使用PuTTY。我的问题是:
- How can I fix this problem?
- Or, can I turn on some debugging to at least identify the precise reason(s) why Git Bash is asking for my user credentials?
- 我该如何解决这个问题?
- 或者,我可以打开一些调试来至少确定 Git Bash 要求我的用户凭据的确切原因吗?
回答by starscream_disco_party
In your terminal, type:
在您的终端中,键入:
git config -l
This will bring up your repository's configuration information. Look at the row remote.origin.url
. From what you're describing it should be: https://github.com/Username/project.git
.
这将显示您的存储库的配置信息。看看行remote.origin.url
。从你的描述来看,它应该是: https://github.com/Username/project.git
。
That means it's using the HTTP protocol instead of SSH! I just had this problem too :) There is an easy fix, though!
这意味着它使用的是 HTTP 协议而不是 SSH!我也刚遇到这个问题:) 不过有一个简单的解决方法!
Just execute this in the terminal:
只需在终端中执行此操作:
git config remote.origin.url [email protected]:Username/project.git
It should take care of things!
它应该照顾的东西!
回答by mipadi
Set up public key authentication for SSH. If you do that, Git shouldn't ask for your password every time.
为 SSH 设置公钥认证。如果你这样做,Git 不应该每次都要求你输入密码。
回答by beduin
You need to set up SSH public key authentication. I described this process in my answer to this question). You can use it with Git Bash.
您需要设置 SSH 公钥认证。我在回答这个问题时描述了这个过程)。您可以将它与 Git Bash 一起使用。
回答by adrian filipescu
Git documentation is the best :). Try these steps first in Git Bash - Windows and after this, look on other sites:
Git 文档是最好的:)。首先在 Git Bash - Windows 中尝试这些步骤,然后在其他站点上查看:
For Eclipse: "Auth Failed" error with EGit and GitHub.
对于 Eclipse:EGit 和 GitHub 出现“身份验证失败”错误。