0
0

More than 1 year has passed since last update.

【vs code】Gitにpushしようとしたら rm: .git/refs/heads/master 2: No such file or directoryを解決

Last updated at Posted at 2022-12-31

環境

Mac(M1, 2020)
vscode5

[概要]

vscodeで画像のようにpush使用としたら突然できなくなっていた。
スクリーンショット 2022-12-31 10.56.51(2).png

ぶつかったエラー

rm: .git/refs/heads/master 2: No such file or directory
rm: .git/gc.log: No such file or directory
fatal: bad object refs/heads/main 2
fatal: failed to run repack
fatal: bad object refs/heads/main 2
error: github.com:aoi-0358/redelivery-app.git did not send all necessary objects

翻訳・意味
rm: .git/refs/heads/master 2: そのようなファイルやディレクトリはありません
rm: .git/gc.log: そのようなファイルまたはディレクトリはありません
致命的: 不正なオブジェクト refs/heads/main 2
致命的: リパックの実行に失敗しました
致命的: 不正なオブジェクト refs/heads/main 2
エラー: github.com:aoi-0358/redelivery-app.git は必要なすべてのオブジェクトを送信しませんでした

色々調べるとgit/refs/heads/master 2: とゆうファイルが生成されているのが原因が一番怪しい
参照記事
https://qiita.com/takemaru_shuna/items/0090486d05a48c42e7ca

やったこと

  1. rm .git/refs/heads/main\ 2 を実行して削除

結果

無事pushできました。

わかったことがあれば追記していきたいと考えています。
間違った認識などあれば教えて頂けたら嬉しいです🙇

追記

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