1. 程式人生 > >Git_錯誤_02_error: src refspec master does not match any

Git_錯誤_02_error: src refspec master does not match any

-m clas src 本地倉庫 目錄 解決方案 結果 log git add

現象:在一個目錄下初始化倉庫之後,就開始push到github,結果出現了這個錯誤。

錯因:初始化倉庫之後,並沒有使用git add,git commit 命令將文件添加到git倉庫中,所以倉庫為空,而空的倉庫是不能提交到github的。

解決方案:

(1)使用命令 ,一次性添加所有文件到暫存區

git  add .

(2)使用命令,將暫存區的文件提交到本地倉庫中。

git  commit  -m" 第一次提交"

(3)使用命令,將本地倉庫中的文件提交到遠程倉庫中

 git push -u  ray_qiyeweixin  master

遠程倉庫ray_qiyeweixin的創建命令為:

git remote add ray_qiyeweixin [email protected]:shirayner/WeiXin_QiYe_Demo.git

Git_錯誤_02_error: src refspec master does not match any