从GitHub创建库

一、创建ssh key

通过SSH key绑定本地主机和GitHub,首先在本地产生一个SSH Key,并将key加入到GitHub帐户的公共Key中。

创建key命令如下:

ssh-keygen -t rsa -C "email" , 出现提示一路回车就可以了。

二、将Key 添加到GitHub

首先安装xclip,sudo apt-get install xclip

然后复制id_rsa.pub的内容

xclip - sel clip < /home/user_name/.ssh/id_rsa.pub

然后到GitHub页面,找到 Account Settings,点击左边的“SSH Keys”,点击“Add SSH Key”, 把“Key”粘贴到“Key”里面,点击“Add Key” 

三、测试

ssh -T git@github.com

如显示:

Hi ...! You've successfully authenticated, but GitHub does not provide shell access. 则表示安装成功

四、创建一个GitHub中的库

使用clone命令

如下: git clone git@github.com:lijiankou/prml.git   , 之后就可以使用了。

如果是第一次push,会出现如下情况:

”No refs in common and none specified; doing nothing.  
Perhaps you should specify a branch such as 'master'.  
fatal: The remote end hung up unexpectedly  
error: failed to push some refs to 'file:///xxxxxxx.git'  

使用下面命令即可:

git push origin master


相关资料:

http://wuyuans.com/2012/05/github-simple-tutorial/

https://help.github.com/articles/generating-ssh-keys

http://blog.csdn.net/feiniao1221/article/details/7516421

http://alexliyu.blog.163.com/blog/static/16275449620128675655428/


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值