在 Git 中推送提交时消息“src refspec master does not match any”
技术问答
287 人阅读
|
0 人回复
|
2023-09-12
|
我克隆我的仓库:9 C. A1 X7 d9 u0 t& {, V# |) Y
git clone ssh://xxxxx/xx.git 但是我改变了一些文件和文件add它们commit之后,我想把它们推到服务器上:
' H: X+ m5 j% Y. F4 r5 z5 `" Q9 ]! tgit add xxx.phpgit commit -m "TEST"git push origin master但我回来的错误是:2 U* M6 u; G E' g' G& C! ]. x
error: src refspec master does not match any. error: failed to push some refs to 'ssh://xxxxx.com/project.git'
) g# @" i9 J! u r
1 o+ x/ H* ]$ [0 I 解决方案: 6 ?( T) }9 ^, r% f+ m
也许你只需要承诺。当我这样做的时候,我遇到了这个:5 A2 m0 {" F8 G7 A* T; N5 Q; _+ i- @
mkdir repo && cd repogit remote add origin /path/to/origin.gitgit add .哎呀!从未承诺!# a( c# d% Y1 @7 z3 d; _
git push -u origin mastererror: src refspec master does not match any.我要做的是:
2 \3 s- r4 G2 _: f/ jgit commit -m "initial commit"git push origin master成功! |
|
|
|
|
|