git下載下傳
官網:https://git-for-windows.github.io
安裝:一直按下一步就行
配置git
設定我們的資訊:
git config --global user.name “Your Name”
git config --global user.email “[email protected]
建立ssh連接配接githbu
ssh-keygen -t rsa -C "[email protected]"
連續三個回車
最後得到了兩個檔案:id_rsa和id_rsa.pub(檔案路徑git上面有顯示)
複制id_rsa.pub的内容到github上(在設定那裡)
測試ssh連接配接是否成功
ssh -T [email protected]
建立項目
有兩種方式:
本地建立倉庫然後遠端連接配接
git init //建立倉庫
git status //檢視狀态
git add *//添加所有檔案
git commit -m "送出描述"
git remote add origin [email protected]:zhonglunsheng/studentExam.git //遠端連接配接
git push -u origin master //送出,第一次加個參數-u 以後就可以直接使用不帶别的參數的git pull從之前push到的分支來pull
遠端克隆項目再送出
git clone [email protected]:michaelliao/gitskills.git
常用指令
git checkout -b v1.0 origin/master //在主幹基礎上生成一個分支
git reset --hard 139dcfaa558e3276b30b6b2e5cbbb9c00bbdca96 //git回退到某個曆史版本
把分支推送到遠端 git push origin HEAD -u