158
102

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Herokuにpush時にdoes not appear to be a git repository出た時の対処

Last updated at Posted at 2018-01-22

起きた問題

git push heroku masterを実行した時、以下のようなエラーが出た

$ git push heroku master

fatal: 'heroku' 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.

gitがリモートのリポジトリを参照出来ていなかった。

vimで.git/configを見てみる。

[remote "origin"]
  url = https://hoge@bitbucket.org/hoge/hoge.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master

remoteの参照先にherokuがなかった。

リモートにherokuを追加する。

vimで.git/configを直接編集してもいいし、コマンドで追加してもいい。

コマンドだとgit remote add heroku https://git.heroku.com/アプリケーション名.gitとする

上記コマンド実行後、再度.git/configを見てみると、remoteにherokuが追加されているのがわかる。

[remote "origin"]
  url = https://hoge@bitbucket.org/hoge/hoge.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "heroku"]
  url = https://git.heroku.com/hoge.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

上記が確認できたら、git push heroku masterでpushができるようになります。

158
102
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
158
102

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?