問題與原因
在https://github.com/settings/keys
已經(jīng)配置了本地的git 通過git-keygen -t rsa
命令生成的秘鑰已經(jīng)配置,而使用 ssh git@github.com
命令得到如下的反饋
$ ssh -T git@github.com
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
這時候只看到successfully以為已經(jīng)配好了密鑰,以后項目都可以連接github了,但其實后面 does not provide shell access
告知了不可以使用shell訪問。
然后使用項目在git push 的時候?qū)⑦€是會提示輸入賬號密碼。并且現(xiàn)在 git 也不允許 http 連接,所以提供賬號密碼也沒辦法 push。
$ git push -u origin main
Username for 'https://github.com': xxx@qq.com
Password for 'https://xxx@qq.com@github.com':
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/xxx/xxx.git/'
這一段的意思你原先的密碼憑證從2021年8月13日
開始就不能用了,必須使用個人訪問令牌(personal access token)
,就是把你的密碼
替換成token
!文章來源:http://www.zghlxwxcb.cn/news/detail-508804.html
解決方案
- 第一種是根據(jù)提示的來使用token的解決方案:作者在這篇文章有提供解決github配置ssh密鑰后仍然需要登錄
- 第二種可以通過以下命令添加遠(yuǎn)程倉庫
git remote set-url origin git@github.com:用戶名/倉庫名.git
注意這里并非普通的http格式添加遠(yuǎn)程倉庫
然后查看遠(yuǎn)程倉庫可以發(fā)現(xiàn)已經(jīng)改變了格式:文章來源地址http://www.zghlxwxcb.cn/news/detail-508804.html
git remote -v
origin git@github.com:xxx/xxx.git (fetch)
origin git@github.com:xxx/xxx.git (push)
到了這里,關(guān)于You‘ve successfully authenticated, but GitHub does not provide shell access.問題解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!