git clone显示不同仓库的“无效用户名或密码”

lsmepo6l  于 2023-09-29  发布在  Git
关注(0)|答案(2)|浏览(132)
  1. $ git clone https://github.com/PixarAnimationStudios/OpenUSD.git
  2. Cloning into 'OpenUSD'...
  3. remote: Invalid username or password.
  4. fatal: Authentication failed for 'https://github.com/org/repo.git/'

git clone命令中的URL是针对OpenUSD存储库的,但错误消息是针对另一个存储库的,它属于我自己的私有存储库。
这是怎么回事?

cfh9epnr

cfh9epnr1#

为了简单地解决这个问题,最好使用ssh密钥而不是http/https
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
主要区别是HTTP/HTTPS需要用户名密码对,当它们更改或忘记它们时,您需要重新设置它们。
有了ssh,您就保存了这种不便

jvlzgdj9

jvlzgdj92#

我的remote.origin.url被设置为我前面引用的私有存储库。
我通过使用以下命令取消设置解决了这个问题:

  1. git config --global --unset-all remote.origin.url

为了验证remote.origin.url,我执行了以下命令:

  1. git config --list

相关问题