gitlab提交代码时ssh报错

之前已经配置过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代码了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值