
一:下载git,https://git-scm.com/downloads(若下载速度慢,可下载百度下的)接下来,默认配置,一直next
二:在github上注册账号,并新建一个项目test(英文有点让你 蓝瘦 ,但是有百度)
三:打开git bash开始配置
git config --global user.email xxx@xxx.com
git config --global user.name "username"
cd ~/.ssh
ssh-keygen -C 'xxx@xxx.com' -t rsa (三个回车)
ssh-add id_rsa
cat id_rsa.pub (复制)
打开github中的setting,添加ssh,将上面复制的id粘贴进去,title随意
ssh git@github.com
若出现
则说明你成功了
若不行:
touch config
vim config
添加下面内容
Host github.com
User xxx@xxx.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
接下来,再尝试ssh git@github.com
成功则出现上面的情况,不成我也没法~
接下来,通过cd任意进入一个文件夹
比如 cd /d
mkdir git
git init (仓库初始化)
git clone git@github.com:username/test.git (将test工程从github上复制进仓库)
cd test
接下来就可以进行项目的修改,更新
touch hello.md
git add hello.md
git commit -m 'first commit'
git remote add origin git@github.com:youusername/test.git
git push -u origin master
这时文件就已经推送成功,可以登录到Github上查看
修改文件:
修改后,git commit -m 'add'
git push -u origin master
若在push时出现
使用
$ git pull --rebase origin master来更新当前仓库的版本
想更具体明白git,http://www.runoob.com/git/git-tutorial.html