2013-06-29 61 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