我在 GitHub 上有一個私有遠程存盤庫,我正在嘗試將它推送到我們的 AWS 服務器上的生產環境(使用 Ubuntu)。我嘗試了以下命令并收到以下錯誤:
sudo git pull
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/projectrepo/projectname.git/'
sudo git remote -v
origin https://project_username:[email protected]/projectrepo/projectname.git (fetch)
origin https://project_username:[email protected]/projectrepo/projectname.git (push)
sudo git remote rm origin
fatal: No such remote: 'origin'
sudo git config --list
user.name=project_username
remote.origin.url=https://project_username:[email protected]/projectrepo/projectname.git
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
sudo git remote set-url origin https://project_username:[email protected]/projectrepo/projectname.git
fatal: No such remote 'origin'
為什么 Git 無法識別origin,我該如何更正此問題以更新remote.origin.url?
uj5u.com熱心網友回復:
您洗掉了原點
git remote rm origin
所以難怪它不再存在,你不能用它做任何事情。您可以通過以下方式將其添加回來:
git remote add origin [address]
原始錯誤表明您不應將 HTTPS 與基本身份驗證一起使用。您應該生成個人令牌并將其放入 URL 或使用 ssh 地址(并??使用公鑰身份驗證):
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/projectrepo/projectname.git/'
uj5u.com熱心網友回復:
想出了答案:我意識到問題是,remote.origin.url設定在全球有OLD_PASSWORD,但當地的NEW_PERSONAL_TOKEN.
這是有效的:sudo git config --global --edit用于直接編輯全域組態檔。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/406880.html
標籤:
