github更新文件

克隆倉庫到本地

git clone 這里寫倉庫地址

image.png

如果已經(jīng)配置SSH key,克隆的時(shí)候倉庫地址記得選SSH地址

更新文件

進(jìn)入項(xiàng)目所在本地文件夾,右鍵-git bash here
git add . (全部文件)
git add filename (需要更新的文件名稱)
git commit -m "提交信息"
git push -u origin main

如果報(bào)錯(cuò): Updates were rejected because the remote contains work that you do hint: not have locally.
則需要先git pull,再push

https://blog.csdn.net/shizhenweiszw/article/details/87486195

報(bào)錯(cuò):Your configuration specifies to merge with the ref 'refs/heads/master'

from the remote, but no such ref was fetched.

解決辦法:
git init

報(bào)錯(cuò):‘origin‘ does not appear to be a git repository

解決辦法:
git remote add origin 這里寫git倉庫地址

報(bào)錯(cuò): Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解決辦法:
先pull再push:
git pull
會(huì)提示:Please enter a commit message to explain why this merge is necessary
解決辦法:
可以直接下面3,4步退出黑框。如果要輸入解釋的話就需要1-4步:
1.按鍵盤字母 i 進(jìn)入insert模式
2.修改最上面那行黃色合并信息,可以不修改
3.按鍵盤左上角"Esc"
4.輸入":wq",注意是冒號(hào)+wq,按回車鍵即可
https://lijunde.blog.csdn.net/article/details/89047553?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control

刪除分支

git push origin --delete 分支名稱

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容