7
7

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.

Macからgitのリモートリポジトリにhttpsでアクセスして"is this a git repository?"と怒られる時

Last updated at Posted at 2014-06-14

Macからhttps接続でリモートリポジトリに git push しようとして、

fatal: https://git.example.com/example.git/info/refs not valid: is this a git repository?

みたいな感じで怒られた時のメモ。
数時間ハマった。

原因は、

  • gitのcredential helperである git-credential-osxkeychain が有効になっていた
  • 過去に同じGitホスティングを別のアカウントで利用していて、その時の認証情報をキーチェーンが記憶していた

というオチ。

本来であれば、別途git-credential-osxkeychainをインストールして、

git config --global credential.helper osxkeychain

で設定しないと有効にならないはずだが、Homebrewでgitをインストールすると、ここまで有効になった状態で入るらしい。

対応としてはキーチェーンアクセスから該当レコードを削除すればよし。

エラーメッセージが分かりにくく、この内容では認証が原因とは思い当たりにくいので残しておく。
一応、デバッグ方法として、

$ GIT_CURL_VERBOSE=1 git push -u origin master

と指定すると通信ログが表示され、よく見ると認証の箇所で

Server auth using Basic with user 'hoge@fuga.com'

などとなっていることが分かる。

7
7
0

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
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?