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

More than 3 years have passed since last update.

githubにterraformのコードを上げようとしたらpre-receive hook declinedのエラーメッセージが出た

Posted at

terraformで書いたコードをgithubにプッシュしようとしたら下記のエラーメッセージが出てpushが出来ない。

git push
Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 4 threads
Compressing objects: 100% (15/15), done.
Writing objects: 100% (19/19), 39.93 MiB | 3.24 MiB/s, done.
Total 19 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: beb5f985c2fbc28e5aa48d6a98099ff68c87a2d132d8727288572ca774c35478
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File ec2-create/.terraform/plugins/darwin_amd64/terraform-provider-aws_v3.29.0_x5 is 196.78 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/atsushi-815/terraform-practice.git
 ! [remote rejected] master -> master (pre-receive hook declined)

原因

terraform initした時に作成された.terraformフォルダにある一部ファイルが100MBを超えていて、githubの制限に引っかかっていた。

解決方法

.terraformは自分でいじらないからコード管理する必要は基本無いので、.gitignoreでコード管理の対象外にして解決。
私の場合、一度commitしてしまって戻すのが面倒だったので、別場所で新たにcloneして、そこに変更内容を持って行って、.gitignoreを使用、.terraformを対象外にしてpush。次はエラーなくpush出来た。

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