之前已经配置过gitlab,在创建新工程并提交代码时ssh报错。

  • 错误详情
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 解决方案,重新生成新的ssh并进行认证
    • 在 “Git Bash” 中输入 ssh-keygen.
    • 此时会生成一个 .ssh文件夹.
    • 在该文件夹下跟根据 git账号生成公钥和私钥 id_rsa,id_rsa.pub
    • 打开 id_rsa.pub文件,复制里面的内容
    • 打开https://gitlab.com/profile/keys,验证自己的gitlab身份并添加key,粘贴刚才复制的 公钥.
    • 现在就可以向gitlab继续push代码了。
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐