回答

收藏

在 Git 中推送提交时消息“src refspec master does not match any”

技术问答 技术问答 238 人阅读 | 0 人回复 | 2023-09-12

我克隆我的仓库:
2 h: A3 I5 S3 U/ y9 b$ Rgit clone ssh://xxxxx/xx.git 但是我改变了一些文件和文件add它们commit之后,我想把它们推到服务器上:
' v3 x5 \, s  U  g% m; s2 y7 lgit add xxx.phpgit commit -m "TEST"git push origin master但我回来的错误是:
) g( [  [; E# ?6 y: o
    error: src refspec master does not match any.  error: failed to push some refs to 'ssh://xxxxx.com/project.git'4 }, T2 u8 C2 p& k
               1 _" E" u  h' ^! X, a" @+ S% o
    解决方案:                                                                " f* e% |/ E# S/ f/ T; u
                                                                也许你只需要承诺。当我这样做的时候,我遇到了这个:
; S% g! _5 T, K3 m( umkdir repo && cd repogit remote add origin /path/to/origin.gitgit add .哎呀!从未承诺!
! W. E' Q6 G$ N1 {6 t% Sgit push -u origin mastererror: src refspec master does not match any.我要做的是:
5 A6 a! n/ t6 n# F- E7 U! xgit commit -m "initial commit"git push origin master成功!
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则