2
1

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 1 year has passed since last update.

【解決】Gitでpushをしたら、(pre-receive hook declined)というエラーが出た

Posted at

初めに

・(pre-receive hook declined)の私のプロジェクトでの解決方法を記載します。
どなたかの役に立てば幸いです。

原因

・リポジトリに100MiB以上のファイル(.assetファイル)をpushしようとしていたみたいです。

事象

リポジトリ名は$REPO_NAMEと変換しています。

git push main
Locking support detected on remote "origin". Consider enabling it with:
  $ git config lfs.https://gitlab.com/$REPO_NAME/info/lfs.locksverify true
Uploading LFS objects: 100% (140/140), 16 MB | 0 B/s, done                      
Enumerating objects: 20292, done.
Counting objects: 100% (20292/20292), done.
Delta compression using up to 4 threads
Compressing objects: 100% (9156/9156), done.
Writing objects: 100% (20290/20290), 123.54 MiB | 1.12 MiB/s, done.
Total 20290 (delta 11539), reused 19724 (delta 11087), pack-reused 0
remote: Resolving deltas: 100% (11539/11539), done.
remote: GitLab: You are attempting to check in one or more blobs which exceed the 100.0MiB limit:
remote: 
remote: - 4cbfca94b72f4df84b51eed01cb734c10a2b9804 (131 MiB)
remote: To resolve this error, you must either reduce the size of the above blobs, or utilize LFS.
remote: You may use "git ls-tree -r HEAD | grep $BLOB_ID" to see the file path.
remote: Please refer to https://gitlab.com/help/user/free_push_limit and
remote: https://gitlab.com/help/administration/settings/account_and_limit_settings
remote: for further information.
To gitlab.com:$REPO_NAME
 ! [remote rejected]   main -> main (pre-receive hook declined)
error: failed to push some refs to 'gitlab.com:$REPO_NAME'

下に
! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'gitlab.com:REPO_NAME'
が出ているのがわかります。

解決方法

結論としては当該ファイルを100MiB以下にすることにより解決しました。

  1. (pre-receive hook declined)で調べる(結構色んな情報があり、試しましたが解決に至らず)

  2. 素直にログを上へ遡りGitLab: You are attempting to check in one or more blobs which exceed the 100.0MiB limit:を発見

  3. 4cbfca94b72f4df84b51eed01cb734c10a2b9804 (131 MiB)が100MiB以上であることを確認

  4. git ls-tree -r HEAD | grep $BLOB_ID $BLOB_IDを3の4cbから始まるハッシュ値で置き換えファイルを特定

  5. Unityの.assetファイル(Atlas)だったため、画像を小さくすることにより解決

以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?