東京生まれHOUSE MUSIC育ち

悪そうな奴はだいたい友達なの?

ファイルサイズが大きくてリモートリポジトリにgit pushできない


スポンサードリンク

f:id:padobure:20210627214303p:plain

事象

gitでリモートのリポジトリにpushしようとしたら、ファイルが大きいとエラーになり、リモートリポジトリにpush出来ませんでした。

$ git push origin master

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

対応手順

以下の手順で対応しました。

ファイルは残したままにしたいので、commit reset--softで戻します。

git reset --soft 5de524e1b368e9e3c2a8f896745c269362e0f0c8

pushしようとしたら、pushできないとエラーメッセージが出力されます。

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.

これに対応するため、以下のようにgit pullしました。

git pull origin master

その後、以下のようにgit pushでリモートにpushしました。

git push origin master