0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Git pushでHTTP 400????

Posted at

概要

Macで開発をしていた際、初めて見かけるGitのエラーに遭遇したので書き残しておきます。

経緯

ローカルからプッシュしようとしたところ、こちらのエラーが生じました。

> git push origin main:main
error: RPC failed; HTTP 400 curl 56 The requested URL returned error: 400
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

400エラー

他のリポジトリではプッシュできるぞ?
なんならmainブランチへの直コミットであればプッシュできるぞ??
なんだこれは???

対応

さっそくですが解決方法です。こちらのコマンドを実行することで解消しました。

git credential-osxkeychain erase

振り返り

  • Macのキーチェーンに古いGitHub認証情報(ユーザー名やパスワード、トークン)が保存されちゃっていたようです。
  • git credential-osxkeychain eraseでこれを削除しました。
  • 削除したことにより
    ①次のプッシュで改めて認証情報が求められるようになる
    ②正しい認証情報で再認証できる
    ③push成功!
    という流れのようです。

お疲れ様でした

お疲れ様でした。
皆様、よりよい Git Life をお過ごしください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?