问题描述
我在Windows 7上使用Git Bash。我们将GitHub作为我们的存储库来源。
I am using Git Bash on Windows 7. We are using GitHub as our repository origin.
每次我推或拉时,我都必须提供用户名和密码凭据。我知道我的SSH密钥设置正确,否则我将无法访问存储库。 (也就是说,一旦输入凭据,推/拉即可正常工作。)
Every time I push or pull I have to provide user and password credentials. I know that my SSH keys are set up correctly, otherwise I would not be able to access the repository. (That is, once I enter my credentials the push/pull works correctly.)
我已输入
git config --global user.name myusername
git config --global user.email myemail
git config --global github.user myusername
git config --global github.token mytoken
尽管如此,每次我推送时都要求我提供凭据/ pull。
But nonetheless I am being asked for credentials each and every time I push/pull.
推荐答案
请确保您使用的是GitHub存储库的SSH URL,而不是HTTPS URL。当您使用HTTPS而不是SSH时,它将询问用户名和密码。您可以检查文件 .git / config
或运行 git config -e
或 git remote显示来源
以验证URL并在需要时进行更改。
Make sure you are using the SSH URL for the GitHub repository rather than the HTTPS URL. It will ask for username and password when you are using HTTPS and not SSH. You can check the file .git/config
or run git config -e
or git remote show origin
to verify the URL and change it if needed.
这篇关于使用Git Bash配置用户和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!