git 致命的:我不处理协议

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17375402/
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-10 16:28:04  来源:igfitidea点击:

fatal: I don't handle protocol

githeroku

提问by Steven W.

When I try to push to Heroku, I get the following error messages.

当我尝试推送到 Heroku 时,我收到以下错误消息。

[first_app]$git push heroku master
fatal: I don't handle protocol '[email protected]:yourhttp'

I then took a look at the different versions of Heroku that I have and there seems to be more than one so I tried deleting it but got another error message.

然后我查看了我拥有的不同版本的 Heroku,似乎不止一个,所以我尝试删除它,但收到了另一条错误消息。

[first_app]$ git remote set-url --delete heroku [email protected]:yourhttp://still-lake-3136.herokuapp.com/.git
fatal: Will not delete all non-push URLs

I searched for similar error messages but was not able to find anything to fix this one. Your help is greatly appreciated.

我搜索了类似的错误消息,但找不到任何解决此问题的方法。非常感谢您的帮助。

Here is my config file:

这是我的配置文件:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:wongsteven/first_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "heroku"]
    url = [email protected]:yourhttp://still-lake-3136.herokuapp.com/.git
    fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
    remote = heroku

not able to push to heroku| git error: cannot handle https| heroku + git submodule needs authentication| error: "fatal: I don't handle protocol ``git` when using bundle install| Git/GitHub can't push to master

无法推送到heroku| git 错误:无法处理 https| heroku + git 子模块需要身份验证| 错误:“致命:我在使用 bundle install 时不处理协议``git`| Git/GitHub 无法推送到 master

回答by Sevin7

Put quotes around the url of the Git repository (this worked for me. I'm using Windows 8.1)

在 Git 存储库的 url 周围加上引号(这对我有用。我使用的是 Windows 8.1)

回答by Casper

The error is in your configuration. This line:

错误出在您的配置中。这一行:

[remote "heroku"]
    url = [email protected]:yourhttp://still-lake-3136.herokuapp.com/.git

Is complete nonsense. I don't know how that line ended up there. You must have copy-pasted something from somewhere the wrong way. My guess is it should look like this:

完全是胡说八道。我不知道那条线是如何结束的。您一定是从某个地方以错误的方式复制粘贴了某些内容。我的猜测是它应该是这样的:

[remote "heroku"]
    url = [email protected]:still-lake-3136.git

If that does not work you should really follow the instruction here to initiate a remote repository:

如果这不起作用,您应该真正按照此处的说明启动远程存储库:

https://devcenter.heroku.com/articles/git

https://devcenter.heroku.com/articles/git

In that case you can delete the whole [remote "heroku"]section (actually the 5 last lines) from your configfile before proceeding with those instructions.

在这种情况下,您可以在继续执行这些说明之前[remote "heroku"]config文件中删除整个部分(实际上是最后 5 行)。

One of those two (editing the line, or reinitializing the repository) should fix your problem.

这两者之一(编辑该行或重新初始化存储库)应该可以解决您的问题。

回答by dusual

Git uses different protocols for you to "push" code this could be https/ssh etc

Git 使用不同的协议让你“推送”代码,这可能是 https/ssh 等

You probably have .git/config file in the root of you repository

您可能在存储库的根目录中有 .git/config 文件

It has config information for origin :

它具有 origin 的配置信息:

[remote "origin"]
#url = ssh://[email protected]/user/repo.git
[email protected]:myheroku.git
fetch = +refs/heads/*:refs/remotes/origin/*

If you see this the url information has git@something:repo.com

如果你看到这个 url 信息有 git@something:repo.com

If you look at the url there you will see that it has something like this [email protected]:yourhttp(url) This is the problem, you have your apps url in the config

如果您查看那里的 url,您会看到它有这样的内容 [email protected]:yourhttp(url) 这就是问题所在,您的应用程序 url 在配置中

On the apps page on heroku you would find the uri for the git repo change the url to that and things should run fine

在 heroku 上的应用程序页面上,您会发现 git repo 的 uri 将 url 更改为该 url,并且事情应该可以正常运行

回答by Deko

Hade same issue, tho cause of it was different from other solutions mentioned here.

有同样的问题,它的原因与这里提到的其他解决方案不同。

Am using SourceTree and when adding remote url, accidentally added extra prefix-space.

我正在使用 SourceTree 并且在添加远程 url 时,不小心添加了额外的前缀空间。

My config (wrong)

我的配置(错误)

url = " ssh://url.com/path/repo.git"

Correct

正确的

url = ssh://url.com/path/repo.git