git推认证失败 [英] git push authentication fails
问题描述
我试图将我的 pythonanywhere [hosting]帐户中的编辑推送到GitHub上的原始主数据中, 。
它要求输入我的GitHub用户名和密码。尽管提供了正确的凭证,但它显示以下错误:
远程:匿名访问akhyansh13 / simplifier.git被拒绝。
致命:https://www.github.com/akhyansh13/simplifier.git/身份验证失败
如何推送?
我会推荐设置公钥认证。 b
$ b
打开Bash控制台,然后使用:
ssh-keygen
生成一个ssh密钥。如果你想加密,你可以选择添加密码(稍后,你可以查看ssh-add和ssh-agent做一些记住我的密码的魔法,但它是可选的)。
然后
cat〜/ .ssh / id_rsa.pub
打印出您的公钥。然后转到github,打开您的账户设置,然后选择添加密钥,然后复制并粘贴上面的公钥
请注意,有时您复制时会发生奇怪的事情+从pythonanywhere粘贴。首先将其粘贴到文本编辑器中,然后删除所有换行符和空格,或者使用文件选项卡导航到它,而不是使用bash shell中的公钥。
完成设置后,您就可以使用 git @
url进行回购。要改变现有的,请执行:
git remote rm origin
git remote add origin git@github.com: akhyansh13 / simplifier.git
然后,最后,您可以
git push -u origin master
推动你的提交。 -u
设置本地主同步到origin / master。
I am trying to push edits from within my pythonanywhere [hosting] account to the origin master at GitHub and fail.
It asks for my GitHub username and password. And it shows the following error, despite providing the correct credentials:
remote: Anonymous access to akhyansh13/simplifier.git denied.
fatal: Authentication failed for 'https://www.github.com/akhyansh13/simplifier.git/'
How do I push?
I would recommend setting up public key authentication.
Open a Bash console and then use:
ssh-keygen
To generate an ssh key. you can choose to add a passphrase if you want to encrypt it (later on, you can look into ssh-add and ssh-agent to do some "remember my passphrase" magic, but it's optional).
Then
cat ~/.ssh/id_rsa.pub
To print out your public key. Then go to github, open your account settings, and choose "add key", and copy and paste the public key above
Be aware that weird things happen sometimes when you copy + paste from pythonanywhere. Either paste it into a text editor first and remove any newlines and spaces, or, instead of using the public key from the bash shell, navigate to it using the "Files" tab.
Once you have those set up, you'll be able to use the git@
urls for your repos. To change an existing one, do:
git remote rm origin
git remote add origin git@github.com:akhyansh13/simplifier.git
Then, finally, you can
git push -u origin master
To push your commits up. The -u
sets the local master to be synced with origin/master.
这篇关于git推认证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!