学无先后,达者为师

网站首页 编程语言 正文

Gitee:使用ssh提交代码却提示:DeployKey does not support push code fatal: Could not read from remote repository

作者:Trine_cui 更新时间: 2022-07-21 编程语言

文章目录

错误描述
错误原因:没有注册ssh公钥
解决办法:
1、生成对应本地仓库的ssh公钥
2、获取对应本地仓库的ssh公钥值
3、将得到的ssh公钥复制,将其添加到我们的远程仓库gitee的SSH公钥上去
再来从本地仓库向远程仓库传值

错误描述

用Git从本地仓库上传服务器仓库报错:DeployKey does not support push code
  在这里插入图片描述
  错误代码:(通过$ git push origin master命令从本地仓库上传到服务器仓库)

$ git push origin master
Access deined: DeployKey does not support push code
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
错误原因:没有注册ssh公钥

解决办法:

添加ssh公钥:

  1. 生成对应本地仓库的ssh公钥
    1.1 选择你要上传代码的文件夹鼠标右键打开Git Bash Here
      找到码云的仓库,复制SSH的地址值
1.2 **输入命令`ssh-keygen -t rsa -C` “ssh地址值”来生成对应本地数据的ssh的key值**,然后回车,遇到(Y/N)输入Y,其它回车就行

在这里插入图片描述
2. 获取对应本地仓库的ssh公钥值
输入cat ~/.ssh/id_rsa.pub命令获取ssh的key值

3. 将得到的ssh公钥复制,将其添加到我们的远程仓库gitee的SSH公钥上去
  3.1 进入码云(gitee),将鼠标放入头像上,进入设置
  在这里插入图片描述
3.2 点开SSH公钥,将我们获取的公钥字符串copy进去,按确定
在这里插入图片描述
 3.3 增加SSH公钥成功
在这里插入图片描述
再来从本地仓库向远程仓库传值
1、输入git push origin master 指令,发现上传远程仓库成功
2、访问码云远程仓库,发现数据已经上传成功了

git config --global user.name "Trine"
git config --global user.email "2792007912@qq.com"
git init
git add .
git commit -m '提交的名字,方便查找'
git remote add origin SSH值
git push
git pull

原文链接:https://blog.csdn.net/weixin_46253682/article/details/125897811

栏目分类
最近更新