github使用ssh方式免密码同步方式

github使用ssh方式免密码同步方式

github可以支持ssh公私钥登陆 , 当同步公钥到github后,可以方便的同步而不用输入密码。

客户端产生公私钥

  1. ssh-kengen -t rsa -C “some comments”,之后有三次询问,直接回车
    如果是cygwin客户端,需要创建/home/user目录

添加公钥到github账户

  1. 使用网页登陆github,在settings–>ssh keys–>add key
  2. cat /home/user/.ssh/id_rsa.pub,把内容粘贴到网页上

测试账号登陆

   ssh git@github.com
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi robinchenyu! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

客户端的下载的仓库应选用ssh方式

git clone git@github.com:username/projectname.git

git设置默认用户名

$ git config --global user.name "username"
$ git config --global user.email "address@mail"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值