无法推送到另一个远程存储库上的功能分支

时间:2018-01-05 09:25:16

标签: git jenkins

我在Jenkins中配置了以下命令,将gitA上的更改推送到gitB存储库。但是我收到了以下错误:

 error: src refspec ... does not match any. error: failed to push some refs to ...

+ /usr/local/bin/git remote rename origin upstream
+ /usr/local/bin/git remote add origin ssh:<gitB repo>
+ /usr/local/bin/git fetch origin
 * [new branch]      master     -> origin/master
+ /usr/local/bin/git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'ssh://<git repo>
Build step 'Execute shell' marked build as failure
Finished: FAILURE

但是,我尝试git push origin origin / master并且Jenkins作业执行成功但没有提交目标repo。

我添加了ssh密钥。请在此处提出建议。我也尝试使用git branch查看源分支,这是正确的。

1 个答案:

答案 0 :(得分:0)

好像你正试图推送一个空的存储库。添加初始提交。

  • git add。
  • git commit -m&#34; initial commit&#34;
  • git push origin master
  • git push upstream master