相关疑难解决方法(0)

在git中推送提交时,src refspec master与any不匹配

我克隆了我的存储库:

git clone ssh://xxxxx/xx.git 
Run Code Online (Sandbox Code Playgroud)

但之后,我改变了一些文件,并addcommit他们,我想他们推到服务器:

git add xxx.php
git commit -m "TEST"
git push origin master
Run Code Online (Sandbox Code Playgroud)

但我得到的错误是:

error: src refspec master does not match any.  
error: failed to push some refs to 'ssh://xxxxx.com/project.git'
Run Code Online (Sandbox Code Playgroud)

git commit

2472
推荐指数
75
解决办法
173万
查看次数

错误:src refspec与any不匹配

我和GitLab的一些朋友有一个项目,当然还有主分支,还有其他一些.当我克隆存储库时,我也用命令创建了一个上游git remote add upstream ....

然后,我发出了git fetch upstream.其次是git checkout upstream/test1.现在,如果我输入git branch -a,我得到这样的输出:

* (HEAD detached at upstream/test1)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/upstream/test1
  remotes/upstream/master
Run Code Online (Sandbox Code Playgroud)

这一切都很好,但后来我对我的upstream/test1分支中的代码做了一些更改,我想将它们推送到origin/test1存储库,我在标题上收到错误消息.请注意,我按照以下步骤推送:

git add .
git commit -m "Sample message"
git push -u origin test1
Run Code Online (Sandbox Code Playgroud)

如果我发出git show-ref,我得到以下输出:

refs/heads/master
refs/remotes/origin/HEAD
refs/remotes/origin/master
refs/remotes/upstream/test1
refs/remotes/upstream/master
Run Code Online (Sandbox Code Playgroud)

我检查了以下问题,但没有发现它有用.任何想法如何解决?

git github

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

git ×2

commit ×1

github ×1