2013-06-29 34 views
9

当我尝试推送到Heroku时,出现以下错误消息。致命:我不处理协议

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

然后我看了看不同版本的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 

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

这里是我的配置文件:

[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

+0

什么是你'的.git/config'文件的内容?将其发布在答案中。 – Casper

+0

嘿卡斯帕,起初,我很难找到文件“.git/config”。然后我可以通过在终端中输入“subl .git/config”来打开.git/config文件。有没有其他的方式来检索这个文件?谢谢! –

回答

1

Git使用不同的协议,为您“推”的代码,这可能是HTTPS/SSH等

你可能已经在你的存储库

它的配置信息的根目录的.git/config文件原产:

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

如果看到此URL信息有混帐东西@:repo.com

如果你看看那里的网址,你会看到它有这样的东西 [email protected]:yourhttp(url)这是问题,你有你的应用程序url在配置

在heroku上的应用程序页面上,你会发现UIT的GIT回购更改网址为和东西应该运行良好

+0

嘿Dusual,谢谢!我能够得到它的工作。 –

3

错误是在您的配置。此行:

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

是完全废话。我不知道那条线是如何结束的。你必须从错误的方式复制粘贴东西。我的猜测是它应该是这样的:

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

如果不工作,你真的应该按照指示在这里启动远程仓库:

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

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

其中一个(编辑行或重新初始化存储库)应该可以解决您的问题。

+0

Hey Casper, 我将这一行“url = [email protected]:yourhttp://still-lake-3136.herokuapp.com/.git”更改为“url = [email protected]:secret-brushlands-7492 .git“,它现在似乎工作。 –

11

周围的Git仓库的URL把双引号(这为我工作。我使用的是Windows 8.1)

+0

该解决方案适用于我。我正在运行命令:$ git remote add origin“https://github.com/MyUserName/my-test-repository.git” 然后我能够运行命令: $ git push --set-upstream origin master –

0

哈得同样的问题,寿原因是从这里提到的其他解决方案不同。

我正在使用SourceTree,并且在添加远程URL时,无意中添加了额外的前缀空间。

我的配置(错误)

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

正确

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