美文网首页
Git连接Coding.net远程仓库时无法push

Git连接Coding.net远程仓库时无法push

作者: duyi324 | 来源:发表于2016-12-13 16:22 被阅读0次

树莓派上安装了Git软件,在Coding.net上创建了版本库,然后clone下来:

pi@raspberrypi:~ $ git clone git@git.coding.net:username/projectname.git

成功clone下来,然后完成一次提交再push回去的时候却报错了,总结原因,写下我的折腾记录。。。

首先要生成ssh密钥,用命令$ ssh-keygen -t rsa -C "username@host.com"生成密钥,默认保存在/home/user/.ssh 目录下,包括id_rsaid_rsa.pub两个文件,其中第一个是私钥,、第二个是公钥。
打开公钥,将所有内容复制,然后去coding.net的我的账户->SSH公钥,将复制的公钥内容粘贴进去,名称和有效日期按照自己的需求定义,最后点击添加。

然后再次push,还是报错,内容大致为:

Permission denied (publickey).
fatal: Could not read from remote repository.

于是继续百度……发现需要把专用密钥添加到ssh-agent的高速缓存中。该命令位置在/usr/bin/ssh-add。来自: http://man.linuxde.net/ssh-add
于是,执行上述命令,发现又报错了:

$ ssh-add ~/.ssh/rsa
Could not open a connection to your authentication agent.

继续搜索解决方案,最终按照以下方法解决了这个问题:
先执行

eval `ssh-agent` (是~键上面的那个`)

再执行 $ ssh-add ~/.ssh/rsa成功,最后 $ ssh-add -l 就可以看到新加的rsa了。
完成如上步骤,再次尝试$ git push,发现终于可以推送成功了~~~

相关文章

  • Git连接Coding.net远程仓库时无法push

    树莓派上安装了Git软件,在Coding.net上创建了版本库,然后clone下来: 成功clone下来,然后完成...

  • 如何将现有的本地仓库与coding.net远程仓库连接

    问题 先在本地初始化了git 仓库,然后在coding.net 新建了项目及远程仓库,将二者连接时,发现无法正常同...

  • 2018-05-14

    删除远程分支: git push 远程仓库 --delete 远程分支 git push 远程仓库:远程分支 本地...

  • git push要输入用户名和密码的问题

    突然遇到git不能连接远程仓库的问题,上网查资料,改密钥,重新配置git。结果可以连接了,但是每次push时要输入...

  • Git命令

    git push 作用:将本地仓库中代码提交到远程仓库 语法 :git push 仓库地址 master git ...

  • Git push到远程gitlab报错问题

    问题描述: 无法实现push操作到gitlab的远程仓库 问题产生流程: 远程仓库地址变更 执行了命令: git ...

  • 访问远程git仓错误

    在使用git pull/push 访问远程仓库时提示:Unable to negotiate with 128.1...

  • 线上服务器 Git 自动更新代码

    团队开发过程中,团队成员 Push 到 git 远程仓库时,远程仓库会自动监听 Push 命令并触发服务器上的 W...

  • git tag

    创建tag git tag [tagName] 将tag push到远程仓库 git push origin [t...

  • git-分支3

    git push origin 推送分支git remote -v 查看远程仓库信息git checkout ...

网友评论

      本文标题:Git连接Coding.net远程仓库时无法push

      本文链接:https://www.haomeiwen.com/subject/ajkbmttx.html