简体   繁体   English

推送到远程存储库时git push错误

[英]git push error while pushing to remote repository

I am getting the following error while trying to push the changes to remote repository. 尝试将更改推送到远程存储库时,我收到以下错误。

Command 命令

git push heroku

Error 错误

fatal: You are pushing to remote 'heroku', which is not the upstream of your current branch 'master', without telling me what to push to update which remote branch.

Can anyone please advise what might be causing the same? 任何人都可以建议可能导致相同的原因吗?

I suspect you don't have remote configured. 我怀疑你没有远程配置。

push likes to know WHAT to push and WHERE to push it. 推动喜欢知道什么推动和推动它。 Usually one configures git so that it automatically tracks branches (local - remote pairs). 通常一个配置git,以便它自动跟踪分支(本地 - 远程对)。

Try pushing: git push heroku master assuming master is your local branch and heroku is a remote. 尝试推送: git push heroku master假设master是你的本地分支而heroku是一个远程。

Also, to see if remote is not configured, (l)ist your config or (e)dit it: git config -l / -e 另外,要查看是否未配置远程,(l)是您的配置还是(e)dit it: git config -l / -e

Since Felix was before me, I'll extend my answer with setting the remote: 由于Felix在我之前,我将通过设置遥控器来扩展我的答案:

git config -l will show you: git config -l会告诉你:

[branch.master.remote] and [branch.master.merge] [branch.master.remote]和[branch.master.merge]

Actually, they are the default behaviors of git pull/push, for example, git push == git push [branch.master.remote] [branch.master.merge] . 实际上,它们是git pull / push的默认行为,例如, git push == git push [branch.master.remote] [branch.master.merge]

By default, [branch.master.remote] = origin, [branch.master.merge] = master, so in this situation git push = git push origin master . 默认情况下,[branch.master.remote] = origin,[branch.master.merge] = master,所以在这种情况下git push = git push origin master

However, in your situation, your origin [branch.master.remote] is not heroku , and git does not know which branch of heroku* you wanna push to, so you must point it for git. 但是,在你的情况下,你的原点[branch.master.remote]不是heroku ,并且git不知道你想要推送到哪个heroku *的分支,所以你必须指向git。

它可能比这更简单,尝试运行heroku登录,如果heroku没有被重新命名为一个命令你很简单没有安装heroku工具带,如果是这样的话,按照该网站上的说明https://toolbelt.heroku .com / debian为您的操作系统

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM