git - "git <refspec> does not look like a ref"尝试将本地分支链接到远程 Heroku 应用程序

标签 git heroku

我已经设置了一个 Heroku 应用,lucy-staging:

Kurts-MacBook-Pro-2:lucy kurtpeek$ git remote -v
staging https://git.heroku.com/lucy-staging.git (fetch)
staging https://git.heroku.com/lucy-staging.git (push)

我有一个本地分支,custom-error-views,我想将其推送到 stagingmaster 分支偏僻的。我正在尝试关注 https://devcenter.heroku.com/articles/multiple-environments#advanced-linking-local-branches-to-remote-apps通过使用命令 git push staging custom-error-views:master,适用于推送 Git 子树:

Kurts-MacBook-Pro-2:lucy kurtpeek$ git subtree push staging custom-error-views:master --prefix lucy-web/
'custom-error-views:master' does not look like a ref

我不明白这个不像ref错误;它似乎类似于 Heroku 文档中的 development:master ref。谁能指出这里出了什么问题?

更新

从源代码 (https://github.com/github/git-msysgit/blob/master/contrib/subtree/git-subtree.sh) 可以看出,此错误消息是专门针对 git subtree 抛出的。它减少了一个事实 git check-ref-format返回非零错误代码:

Kurts-MacBook-Pro-2:lucy kurtpeek$ git check-ref-format custom-error-views:master
Kurts-MacBook-Pro-2:lucy kurtpeek$ echo $?
1

最佳答案

我设法使用以下命令将子树推送到远程的主分支:

git push staging `git subtree split --prefix lucy-web staging`:master

这可以概括为以下几点:

git push [REMOTE_NAME] `git subtree split --prefix [SUBDIR_PATH] [BRANCH]`:master

使用此摘要,上面的示例具有以下结构:

  • 远程名称 - 暂存
  • 子目录路径 - lucy-web
  • 分支机构 - 暂存

这类似于 How can I push a part of my git repo to Heroku? 给出的答案之一

关于git - "git <refspec> does not look like a ref"尝试将本地分支链接到远程 Heroku 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49244934/

相关文章:

python - 尝试为 python (psycopg2) 安装 Postgres 时出错

git - GitLab 中不显示重音

gitignore 不会忽略文件

git - 使用 git 同时提交到多个分支

Git - 不要听嵌套目录中的命令

linux - git 在提交 linux 时使用 root 而不是我的用户名

java - 如何使用 Spring Security 设置无限 session 超时

ruby-on-rails - 我可以使用 Heroku Piggyback SSL 登录主网站吗?

Heroku 推送拒绝,未检测到 Cedar 支持的应用程序

heroku - 如何使用 API 将 "authorized redirect URIs"添加到 Google OAuth2?