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

前端 未结 30 2132
轮回少年
轮回少年 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:02

    Missing or skipping git add . or git commit may cause this error:

    git push -u origin master
    Username for 'https://github.com': yourusername
    Password for 'https://yourusername@github.com': 
    error: src refspec master does not match any.
    error: failed to push some refs to 'https://github.com/yourusername/foobar.git'
    

    To fix it, reinitialize and follow the proper sequence:

    git init
    git add .
    git commit -m 'message'
    git *create remote
    git push -u origin master
    

提交回复
热议问题