Message 'src refspec master does not match any' when pushing commits in Git

前端 未结 30 2116
轮回少年
轮回少年 2020-11-22 02:49

I clone my repository with:

git clone ssh://xxxxx/xx.git 

But after I change some files and add and commit them,

30条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 03:05

    I also had a similar error after deleting all files on my local computer, and I have to clean up all files in the repository.

    My error message was something like this:

    error: src refspec master does not match any.
    error: failed to push some refs to 'git@github ... .git'
    

    And it was solved by executing the following commands:

    touch README
    git add README
    
    git add (all other files)
    git commit -m 'reinitialized files'
    git push origin master --force  # <- caution, --force can delete others work.
    

提交回复
热议问题