[英]git@github.com: Permission denied (publickey). fatal: Could not read from remote repository
I'm new to git and anytime i try to push to my repository using "git push origin master", i get this error我是 git 新手,每当我尝试使用“git push origin master”推送到我的存储库时,我都会收到此错误
git@github.com: Permission denied (publickey). git@github.com:权限被拒绝(公钥)。 fatal: Could not read from remote repository.
致命:无法从远程存储库读取。
i believe i must have incorrectly entered my git credentials (username or password) and the system have saved the incorrect credentials.我相信我一定是错误地输入了我的 git 凭据(用户名或密码),并且系统保存了错误的凭据。 Please how do I delete the already stored credentials so that i can be prompted to enter again my credentials when i want to push to my repository.
请如何删除已存储的凭据,以便在我想推送到我的存储库时提示我再次输入我的凭据。 i use Linus OS.
我使用 Linus 操作系统。
Thank you.谢谢你。
When using git over ssh, you need a public/private key pair.在 ssh 上使用 git 时,您需要一个公钥/私钥对。
~/.ssh/id_rsa.pub
.~/.ssh/id_rsa.pub
。Alternativly, you can just push to the GitHub repository with HTTPS and your GitHub login, by doing或者,您可以使用 HTTPS 和您的 GitHub 登录名推送到 GitHub 存储库,方法是
git remote set-url --push https://github.com/<username>/<repository>.git
and pushing the repository.并推送存储库。
(first create a repository in git, if not created already) (首先在git中创建一个存储库,如果尚未创建)
This worked for me:这对我有用:
Step 1- git remote rm origin步骤 1- git remote rm origin
Step 2- select the http option in github步骤 2-在 github 中选择 http 选项
step 3- run the following command again第 3 步 - 再次运行以下命令
git remote add origin https://github.com/yourdirectory/link.git git 远程添加源https://github.com/yourdirectory/link.git
git branch -M main git 分支 -M 主
git push -u origin main git push -u origin main
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.