網站首頁 編程語言 正文
遇到一個git的大坑 src refspec master does not match any error: failed to push some refs to
作者:hello-java-maker 更新時間: 2022-04-14 編程語言今天本來想把內容上傳到git倉庫去,但是折騰了好久一直報錯。
錯誤信息是這樣的。
error: src refspec master does not match any error: failed to push some refs to
這個錯誤其實是很常見的錯誤,但是一直沒有解決,試了很多方法,結果都不行。
這個問題的常見原因有:
1.本地git倉庫目錄下為空
2.本地倉庫add后未commit
3.git init錯誤
4.沒有先進行git pull
但是我的都不是這些原因。我的問題在于,我的這個本地項目早就存在了,但是一直沒有使用git,于是我想直接在項目中創建git倉庫,直接git init
,就是這種方式導致的。
常規方式是:創建文件夾->git init -> git add . -> git commit -> git push.
我的方式是:已有陳舊項目->git init -> git add . -> git commit -> git push.
因此,導致我一直失敗,所以,只需要采用常規方式即可解決問題!
更新
最新的一個問題是,現在github的默認分支為main,但是,我一直認為是master,所以,在提交時,需要提交到main,而不是master。
使用:git push origin main
,即可。
原文鏈接:https://blog.csdn.net/sihai12345/article/details/115432052
相關推薦
- 2022-11-01 詳解golang中的閉包與defer_Golang
- 2022-09-03 PyQt5實現tableWidget?居中顯示_python
- 2022-06-17 android實現可上下回彈的scrollview_Android
- 2023-04-19 Android使用gradle讀取并保存數據到BuildConfg流程詳解_Android
- 2022-07-19 Compose中更靈活易用的TextField以及密碼輸入框
- 2022-07-18 CSS浮動定位與背景樣式
- 2022-05-15 Element框架里日期選擇器限制時間,最多選31天
- 2023-01-03 Kotlin中Lambda表達式與高階函數使用分析講解_Android
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支