1.配置ssh向?qū)?/h3>
小編是利用git bash用命令生成
ssh-keygen -t rsa -C "輸入你需要綁定的郵箱" -b 4096
回車(chē)會(huì)出現(xiàn)
Enter file in which to save the key (/c/Users/ztt/.ssh/id_rsa):
輸入你的文件名類(lèi)似ztt_rsa(后綴名不可變)
回車(chē)提示
Enter passphrase (empty for no passphrase):
直接回車(chē)即可。
2.找到你生成的rsa文件鼠证,小編的文件在C:\Users\ztt\.ssh
下葬燎,如果同時(shí)使用gitlab和github建議分開(kāi)命名
3.在C:\Users\ztt\.ssh
下新建config配置文件
#github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_rsa
4.通過(guò)git pull句狼,git push測(cè)試是否配置成功疗认。
git使用(最近做項(xiàng)目使用到的命令)
1.我自己的代碼巍举;建立本地倉(cāng)庫(kù)筷频,初始化张肾,配置git config管宵,
2.克隆下來(lái)代碼截珍,切換分支V1.0.2->git add 文件夾->git commit -m “備注”->git push ;
隨時(shí)查看狀態(tài)git status
3.沖突git pull --rebase 在需要上傳的分支上執(zhí)行這個(gè)操作->git add .文件->git rebase --continue ->git push
4.如果你發(fā)現(xiàn)代碼提交錯(cuò)誤,查看提交歷史git log->git reset heard HEAD xx(可以回退到之前的版本);或則利用 git rebase --abort 會(huì)回到rebase操作之前的狀態(tài)啄糙,之前的提交的不會(huì)丟棄笛臣;
新手上路,有錯(cuò)誤歡迎批評(píng)指正