git子树推送出现“不合格的目的地”错误

时间:2013-09-07 15:16:30

标签: git heroku

我刚创建了一个新的Heroku应用程序而且我无法将我的repo(分支backend)的子树文件夹staging推送到新创建的应用程序myapp-staging(没有分支)尚未)。

以下是我推送子树的方法:

git push heroku `git subtree split --prefix=backend staging`:master

相关错误:

error: unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@heroku.com:myapp-staging.git'

我试过了git fetch heroku。这个“不合格的目的地”是什么意思?这个命令不应该创建远程分支吗?

2 个答案:

答案 0 :(得分:9)

好的,感谢http://makingsoftware.wordpress.com/2013/02/16/using-git-subtrees-for-repository-separation/

我试过了:

git subtree split --prefix=bakcend -b test
git push heroku test:master

它就像一个魅力。问题可能是使用子树命令创建分支...

答案 1 :(得分:1)

正如here所述,您可以推送到refs/heads/master来解决此问题,之后您可以更改回master,尽管我仍然不完全确定/为什么/这个的工作原理。

# run this once
git push origin master:refs/heads/master

# now you can use this forever
git push origin master
相关问题