参考自该链接
1. 本地初始化git
- git init :创建一个.git目录
- git status -sb可以查看git下文件的状态
- git add 文件路径 :添加文件到暂存区/git add .
- git commit -m “版本1”:添加该版本说明
2.上传到github
- 生成RAS key
- git remote add orgin —(---为SSH内容)
- git push -u origin master
- 出错
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'github.com:gasSolid/openfoam-trick.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这是由于github的文件夹内和现在push的内容不一致,所以需要把github的内容下载本地
git pull --rebase origin master
然后重新push即可。