微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu下ssh密钥到github(或者coding)

1.为Git创建全局name和全局email:

$git config --global user.name "你的名字"
$git config --global user.email "你的邮箱"
 

2.打开terminal,判断是否有ssh软件(步骤略);


3.用ssh-keygen命令在个人文件夹下生成公钥密钥:

$cd ~/ && ssh-keygen -t rsa -C "你的邮箱"
 

4.进入~/.ssh文件夹:

$cd .ssh
 

5.把密钥文件加入ssh中:

$ssh-add id_rsa

5(branch).如果生成key加不到 ssh 中,ssh-add id_rsa 命令报错Could not open a connection to your authentication agent,请先使用下列命令再使用step five的命令:

$ssh-agent bash
 

6.把公钥文件(id_rsa.pub)中的码复制到github(或者coding)网站的ssh密钥管理中(帐号中心);


7.判断ssh钥匙是否成功:

  • 测试github
$ssh -T git@github.com
  • 测试coding
$ssh git@git.coding.net
 

8.进入本地仓库并且配置ssh地址

$git remote rm origin
$git remote add origin ssh的地址
以上配置完成了ssh到github(或者coding)

原文地址:https://www.jb51.cc/ubuntu/351585.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐