Git——推送本地倉庫到遠程時出現錯誤“error: src refspec master does not match any”


解決

參考鏈接:https://www.jianshu.com/p/8d26730386f3

后續問題

以上參考解決方法寫得很詳細,但是我一步步運行后還是出現類似錯誤:
“error: src refspec master does not match any
error: failed to push some refs to 'e.coding.net:poowicat/vuepress_blog_rescoure
/blog-source.git'

於是回想起來,我之前把分支改成了master——>mian
然后按照參考博客解決方法重新執行一遍,把git push origin master改成git push origin main於是成功解決問題!!!

實際上

git init
這一步之后創建了一個名為.git的文件夾,不過它在默認狀態下是隱藏的,系統將隱藏文件夾顯示出來,可以看到有這樣一個文件夾。
github上傳項目方法:
git@e.coding.net:poowicat/vuepress_blog_rescoure/blog-source.git
在你的電腦上裝好git

大致流程是:

1、在github上創建項目

2、使git clone git@e.coding.net:poowicat/vuepress_blog_rescoure/blog-source.git 克隆到本地

3、編輯項目

4、git add . (將改動添加到暫存區)

5、git commit -m "提交說明"

6、git push origin main 將本地更改推送到遠程master分支(這里我已經將我的本project命名為main分支。

這樣你就完成了向遠程倉庫的推送。

如果在github的remote上已經有了文件,會出現錯誤。此時應當先pull一下,即:

git pull origin master

然后再進行:

git push origin master

修改項目內容有更新在遠程上

  1. git commit -m "修正圖片路徑"
  2. git pull
  3. git push


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM