2013-06-28 44 views
5

我正在運行以下命令並獲得fatal: remote heroku already exists.錯誤。致命:遠程heroku已經存在

我不知道這裏有什麼問題,它以前沒有錯誤就可以正常工作。

git init 
git add . 
git commit -m 'Initial commit' 
git remote add heroku [email protected]:myapp.git 

回答

13

開放的.git/config中,你會發現

[remote "heroku"] 
url = [email protected]:xxx.git 
fetch = +refs/heads/*:refs/remotes/heroku/* 

變更XXX你要推的應用程序名稱。然後

git push heroku master 

它適用於我。你可以試試。

0

你只應該運行一次「git remote add」。也許你正在尋找「git push」?

0

您是否試圖在以前做過的同一個目錄中遠程添加heroku?如果是這樣,嘗試在不同的一個,它應該工作。

0

你可能想:

git add . 
git commit -m 'Information about what is in this commit' 
git push heroku master 

注意我喜歡git commit在命令行上-m選擇,因爲它給了我一個機會在提交之前審查的東西。

+0

我做到了這一點,它以前工作。我收到,錯誤:src refspec master現在不匹配任何。 – Efe

+0

請做'git status'並告訴我們結果 –

+0

如果目錄爲空,也會發生這種情況。請在目錄上爲我們做一個'ls'。 –

0

你看過你的.git/config文件嗎?您可能已經爲Heroku建立了一個遙控器。而faffaffaff是正確的,因爲您只需建立一次,並且您需要使用git push將任何內容推送到遠程存儲庫,而不是git remote add

0

您正試圖添加一個已存在的git remote。如果在與之前的命令相同的文件夾中運行git remote -v命令,您將看到本地存儲庫已知的所有遠程存儲庫的列表。您應該看到(用於獲取一個推,一個)兩個條目稱爲Heroku的

git remote -v 

如果您使用在同一文件夾中的heroku create命令,將添加了遠程Git倉庫作爲別名的Heroku。如前所述,不需要再添加它。

# create your project 
git init 
git add . 
git commit -m "useful commit message" 

# run heroku create only once (unless you want additional environments - test, stageing) 
heroku create 

# deploy to heroku 
git push heroku master 

繼續增強您的代碼並將其添加/提交到您的本地git存儲庫。當您準備再次部署時,請推送至heroku。

# work on your code 
git add . 
git commit -m "useful commit message" 
git push heroku master 
相關問題