git 使用总结

1: 从网上下载代码到本地

git clone https://github.com/openresty/ngx_openresty.git

如果不能下载

ssh-keygen -t rsa
 cat ~/.ssh/id_rsa.pub

然后在你的账户里面添加KEY,把id_rsa.pub内容复制进去

2: 新建代码库

echo "# test2" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/zenglingbo/test2.git
git push -u origin master

3: 代码更新

git clone代码到本地 或者 在自己已有的文件下 git pull 代码到本地
git add 新加的文件/更改的文件
git commit -m "提示信息"
git push -u origin master
(期间可以用git status 和 git log 来查看代码的状态和历史)
原文地址:https://www.cnblogs.com/zeng2013/p/4728315.html