首页 > Web开发 > 详细

Git 如何使用ssh上传或者同步/下载项目到github

时间:2019-09-11 12:55:36      阅读:150      评论:0      收藏:0      [点我收藏+]

前言

  使用github上传托管自己的一些工具代码是作为一个程序员必备技能.下面就说明如何github使用ssh方式免密码同步方式

客户端产生公私钥

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"

Git 如何使用ssh上传或者同步/下载项目到github

原文:https://www.cnblogs.com/guanxinjing/p/11505193.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!