当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当前回答
仔细检查存储库URL, Github将提示您登录,如果回购不存在。
我猜这可能是为了检查你是否有私人回购权。可能是为了让私人回购更难列举。但这都是猜测。/耸耸肩
其他回答
像这样替换你的远程url:
git remote set-url origin https://<username>@github.com/<username>/<repo>.git
我也面临着同样的问题。当我使用HTTPS URL克隆一个repo,然后尝试推送更改(在Linux/Mac上使用Shell或在Windows上使用Git Bash)时,出现了这个问题:
git clone https://github.com/{username}/{repo}.git
但是,当我使用SSH URL克隆时,这个问题没有发生:
git clone git@github.com:{username}/{repo}.git
如果你已经使用HTTPS克隆了repo,并且不想重做所有事情,你可以使用set-url将原始URL更改为SSH URL:
git remote set-url origin git@github.com:{username}/{repo}.git
注意:我有SSH密钥添加到我的GitHub帐户。如果没有设置SSH密钥,这种方法也不能工作。
仔细检查存储库URL, Github将提示您登录,如果回购不存在。
我猜这可能是为了检查你是否有私人回购权。可能是为了让私人回购更难列举。但这都是猜测。/耸耸肩
按照步骤在这里设置SSH密钥:https://help.github.com/articles/generating-ssh-keys
OR
git remote add origin https://{username}:{password}@github.com/{username}/project.git
更新:如果你得到"fatal: remote origin already exists.",那么你必须使用set-url:
git remote set-url origin https://{username}:{password}@github.com/{username}/project.git
这是系统凭据缓存中存储的凭据的问题。你可能有配置变量“credential”。Helper '设置为wincred或winstore,它无法清除它。如果启动控制面板并启动凭据管理器applet,那么在标记为git:https://github.com的通用凭据部分中寻找项目。如果您删除了这些,那么下次将重新创建,但是凭据帮助实用程序将要求您提供新的凭据。