转载地址:多个
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
- $
ssh -vT git@github.com - #
... - #
Agent admitted failure to sign using the key. - #
debug1: No more authentication methods to try. - #
Permission denied (publickey).
For most users, simplyrunning ssh-add
- $
ssh-add - #
Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap] - #
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
- $
ssh-add ~/.ssh/my_other_key - #
Enter passphrase for /home/you/.ssh/my_other_key: [tappity tap tap] - #
Identity added: /home/you/.ssh/my_other_key (/home/you/.ssh/my_other_key)
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 remote add origin https://github.com/sidedish/libjpeg-turbo-1.3.0.git
git push -u origin master