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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15845823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:24:24  来源:igfitidea点击:

git push error while pushing to remote repository

githeroku

提问by misguided

I am getting the following error while trying to push the changes to remote repository.

尝试将更改推送到远程存储库时出现以下错误。

Command

命令

git push heroku

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.

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?

任何人都可以请告知可能导致相同的原因吗?

回答by LAFK says Reinstate Monica

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 masterassuming 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) 编辑它: git config -l / -e

Since Felix was before me, I'll extend my answer with setting the remote:

由于 Felix 在我之前,我将通过设置遥控器来扩展我的答案:

回答by loql

git config -lwill 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。

回答by user1293367

It could be more simple than that, try to run heroku login, if heroku is not reconigzed as a command you simple don't have the heroku toolbelt installed if that is the case follow the instructions on that site https://toolbelt.heroku.com/debianfor your OS

可能比这更简单,尝试运行 heroku 登录,如果 heroku 没有被重新配置为命令,那么您简单的没有安装 heroku 工具带,如果是这种情况,请按照该站点上的说明进行操作https://toolbelt.heroku .com/debian适用于您的操作系统