github疑難問題---1、error: src refspec master does not match any.
一、總結
一句話總結:
問題原因是沒匹配到master分支,所以用git push提交到遠程分支的時候指定分支為main就好:git push -u origin main
1、git提交修改到遠程倉庫代碼?
1、【git add .】:將改動添加到暫存區
2、【git commit -m "提交信息"】:git commit 命令用來將本地暫存的修改提交到版本庫
3、【git push -u origin master】:將代碼修改推送到遠程倉庫的master分支
二、error: src refspec master does not match any.
系列課程的視頻位置:
1、error: src refspec master does not match any.-范仁義-讀書編程筆記
https://www.fanrenyi.com/video/41/363
2、git中的工作區、暫存區和版本庫分別是什么-范仁義-讀書編程筆記
https://www.fanrenyi.com/video/41/364
3、git reset --hard HEAD~2誤刪操作恢復-范仁義-讀書編程筆記
https://www.fanrenyi.com/video/41/365
4、github綁定ssh key-范仁義-讀書編程筆記
https://www.fanrenyi.com/video/41/366
博客對應課程的視頻位置:1、error: src refspec master does not match any.-范仁義-讀書編程筆記
https://www.fanrenyi.com/video/41/363
問題原因是沒匹配到master分支,所以用git push提交到遠程分支的時候指定分支為master就好:git push -u origin main
三、工作區和版本庫
工作區:就是你在電腦上看到的目錄,比如目錄下testgit里的文件(.git隱藏目錄版本庫除外)。或者以后需要再新建的目錄文件等等都屬於工作區范疇。
版本庫(Repository):工作區有一個隱藏目錄.git,這個不屬於工作區,這是版本庫。其中版本庫里面存了很多東西,其中git的配置、暫存區、日志等等,還有Git為我們自動創建了第一個分支master,以及指向master的一個指針HEAD。
我們前面說過使用Git提交文件到版本庫有兩步:
第一步:是使用 git add 把文件添加進去,實際上就是把文件添加到暫存區。
第二步:使用git commit提交更改,實際上就是把暫存區的所有內容提交到當前分支上。
四、git提交修改到遠程倉庫代碼
1、git add . :將改動添加到暫存區
2、git commit -m "提交信息" git commit 命令用來將本地暫存的修改提交到版本庫
-m參數是輸入提交信息的
3、git push -u origin master 將代碼修改推送到遠程倉庫的master分支
