【问题标题】:Cannot push local repository to GitHub (returning error 403)无法将本地存储库推送到 GitHub(返回错误 403)
【发布时间】:2020-07-12 13:57:19
【问题描述】:

我正在尝试将本地 Xcode 项目推送到 GitHub,但出现以下错误:

git push -u origin master
remote: Weak credentials. Please Update your password to continue using GitHub.
remote: See https://help.github.com/articles/creating-a-strong-password/.
fatal: unable to access 'https://github.com/josiah-brown/Test1.git/': The requested URL returned error: 403

我已经尝试将 url 更改为 ssh 而不是 https,但随后出现此错误:

Test $ git push -u origin master 
Warning: Permanently added the RSA host key for IP address ' 140.82.113.3' to the list of known hosts.
git@github. com: permission denied (publickey)    
fatal: Could not read from remote repository.
Please make sure you have the correct access rights 
and the repository exists.

我已经在 GitHub 上更改了我的密码,以确保它不违反强密码要求,但这并没有解决问题。 有谁能帮忙吗?

【问题讨论】:

  • 欢迎来到 Stack Overflow :) 通过运行 ssh -T git@github.com 检查您是否可以成功建立与 GitHub 的连接。另外,运行ssh-add -K ~/.ssh/id_rsa(或将其替换为您的私钥的名称)以将 SSH 密钥添加到您的 SSH 代理,然后重试。
  • @phd 对不起,我之前回答的时候没有解决这个问题。我现在已经这样做了(Google Lens 派上用场了)
  • @phd 我一直在使用它,它就像魔术一样!
  • @NimeshNeema 我只需使用我的手机,打开镜头,选择文本并将其复制到谷歌文档。在我的计算机上,我打开同一个 Google 文档(由 Google 自动同步),然后...我从该 Google 文档中复制文本到您的问题中。
  • @filbranden Google Lens 也可以使用屏幕截图 (androidauthority.com/google-lens-screenshot-1029772):在您的手机上拍摄一张,然后在上面应用 Google Lens ;)

标签: xcode git github terminal


【解决方案1】:

确保使用 HTTPS URL 输入:

注意:我没有看到any repository in your GitHub page profile,所以Test1 可能是一个私人仓库。
如果没有,请先在 GitHub 上创建。


推送到 GitHub 时,我从未被提示输入密码。此外,存储库现在是公开的。

这是典型的:

  • HTTP URL
  • 缓存凭据:检查git config credential.helper

如果缓存的密码太弱,需要remove it from the cache

然后,在下一次推送时,系统会要求您输入用户名/密码。
再次,先更改您的密码(当前密码太弱)。

【讨论】:

  • 什么时候输入密码?推送到 GitHub 时,我从未被提示输入密码。此外,存储库现在是公开的。
  • @JBrown 我已经编辑了答案以解决您的评论。
  • 感谢您的帮助!我发现终端正在使用我多年前创建并忘记的旧 GitHub 帐户的凭据。我能够更新凭据并且它起作用了
猜你喜欢
  • 2017-11-27
  • 2021-01-08
  • 2016-09-03
  • 2021-11-27
  • 2021-12-22
  • 2021-09-28
  • 2016-05-10
  • 2012-08-25
  • 2011-12-09
相关资源
最近更新 更多