ばくのエンジニア日誌

技術的なメモなどを書いていきます。

Herokuにpushできない時の対処法

Herokuにpushできなかった時の対処法をメモ。
まず、エラーを見てみます。

C:\first_app>git push heroku master
fatal: 'git_url' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

リモートリポジトリが正しく設定されていないようです。
確かに、heroku createした際に少し不思議な表示になっていました。

C:\first_app>heroku create
Creating warm-mesa-6841... done, stack is cedar
web_url | git_url
Git remote heroku added

gitのリモートリポジトリを確認するために、以下を実行。

C:\first_app>git config -l

・・・途中省略・・・

remote.heroku.url=git_url
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*

remote.heroku.urlの値が"git_url"になってしまっていました。
リモートリポジトリを変更するので、Herokuのアプリ管理ページ>SettingsでリポジトリのURLを確認します。

f:id:bakunyo:20140202002104p:plain

で、以下コマンドを実行。

C:\first_app>git remote set-url heroku git@heroku.com:warm-mesa-6841.git
※末尾のURLは適宜変更

これでpushできるようになりました!