github使用指南(整理并转载)

转载地址:多个

github(https://github.com)是一个基于git的代码托管平台,付费用户可以建私人仓库,我们一般的免费用户只能使用公共仓库,也就是代码要公开。。

1.注册账户以及创建仓库

要想使用github第一步当然是注册github账号了。之后就可以创建仓库了(免费用户只能建公共仓库),Createa NewRepository,填好名称后Create,之后会出现一些仓库的配置信息,这也是一个git的简单教程。


2.配置Git

首先在本地创建ssh key;

1
$ssh-keygen-t rsa -C "your_email@youremail.com"

后面的your_email@youremail.com改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。

回到github,进入Account Settings,左边选择SSHKeys,Add SSH Key,title随便填,粘贴key。为了验证是否成功,在git bash下输入:

1
$ssh -T git@github.com

如果是第一次的会提示是否continue,输入yes就会看到:You’vesuccessfully authenticated, but GitHub does not provide shellaccess 。这就表示已成功连上github。

此过程中可能会遇到以下Error:

Error: Agent admitted failure tosign

 Thiserror appears to only occur on Linux systems. For more details,see thisissue report.

C代码  收藏代码
  1. ssh -vT git@github.com  
  2. ...  
  3. Agent admitted failure to sign using the key.  
  4. debug1: No more authentication methods to try.  
  5. Permission denied (publickey).  

 Resolution

For most users, simplyrunning ssh-add toload your keys into the SSH agent will fix this issue.

 C代码  收藏代码

  1. ssh-add  
  2. Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]  
  3. Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)  
   

If your key does not have the default filename,you'll have to pass the path to ssh-add

 C代码  收藏代码

  1. ssh-add ~/.ssh/my_other_key  
  2. Enter passphrase for /home/you/.ssh/my_other_key: [tappity tap tap]  
  3. Identity added: /home/you/.ssh/my_other_key (/home/you/.ssh/my_other_key)  


3.在github上创建一个库:例如libjepg-turbo-1.3.0
创建完成后,如何在本地创建一个新库,并上传:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/sidedish/libjpeg-turbo-1.3.0.git
git push -u origin master
创建完成后,如何在配以一个已有的git库,并上传:
git remote add origin https://github.com/sidedish/libjpeg-turbo-1.3.0.git
git push -u origin master
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值