Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

git - 在Git中推送提交时出现消息“ src refspec master不匹配”(Message 'src refspec master does not match any' when pushing commits in Git)

I clone my repository with:

(我用以下方法克隆我的存储库:)

git clone ssh://xxxxx/xx.git 

But after I change some files and add and commit them, I want to push them to the server:

(但是,在我更改了一些文件并addcommit它们之后,我想将它们推送到服务器:)

git add xxx.php
git commit -m "TEST"
git push origin master

But the error I get back is:

(但是我得到的错误是:)

error: src refspec master does not match any.  
error: failed to push some refs to 'ssh://xxxxx.com/project.git'
  ask by sinoohe translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Maybe you just need to commit.

(也许您只需要提交即可。)

I ran into this when I did:

(我这样做的时候遇到了这个问题:)

mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .

Oops!

(糟糕!)

Never committed!

(从未犯过!)

git push -u origin master
error: src refspec master does not match any.

All I had to do was:

(我要做的就是:)

git commit -m "initial commit"
git push origin master

Success!

(成功!)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...