使用Git Bash配置用户和密码 [英] Configuring user and password with Git Bash

查看:1705
本文介绍了使用Git Bash配置用户和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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配置用户和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆