[Git] git push したら error: pack-objects died of signal 13
git push でエラーが発生し、bitbucket へ push ができなくなりました。
[markdown]
## 状況
“`prettyprinted
% git push -u origin dev
Counting objects: 141, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (139/139), done.
Write failed: Broken pipe/141)
fatal: The remote end hung up unexpectedly
error: pack-objects died of signal 13
error: failed to push some refs to ‘git@bitbucket.org:****/****.git’
“`
## 対応
下記は GitHub ですが、どうもエラーの内容は file size が大きすぎると言うことらしいです。
試しに psd ファイルを登録したことが原因かもしれない。
> * [git – Can’t push to GitHub error: pack-objects died of signal 13 – Stack Overflow](http://stackoverflow.com/questions/18559015/cant-push-to-github-error-pack-objects-died-of-signal-13)
.gitignore に *.psd を入れているディレクトリを追加します。
これで今後はインデックスに登録されなくなります。
“`:.gitignore
docs/psd/
*.psd
“`
さらに今までに登録されていた情報を削除します。
> * [.gitignoreでインデックスに登録したくないファイルを指定する | Smart](http://rfs.jp/server/git/gitignore.html)
“`prettyprinted
% git rm -r –cached docs/psd/
“`
.gitignore の変更をコミットしました。
“`prettyprinted
% git add .
% git commit -m ‘add: .gitignore *.psd’
“`
さらに必要か分かりませんが、`git gc` しておきました。
> * [Git – メインテナンスとデータリカバリ](http://git-scm.com/book/ja/Git%E3%81%AE%E5%86%85%E5%81%B4-%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%86%E3%83%8A%E3%83%B3%E3%82%B9%E3%81%A8%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AA%E3%82%AB%E3%83%90%E3%83%AA)
“`prettyprinted
% git gc
Counting objects: 1394, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1351/1351), done.
Writing objects: 100% (1394/1394), done.
Total 1394 (delta 843), reused 0 (delta 0)
Removing duplicate objects: 100% (256/256), done.
“`
`git push` して無事完了。
“`prettyprinted
% git push -u origin –all
“`
binary ファイルの登録には気をつけた方が良いのかもしれません。
## 補遺
Bitbucket には、limit がないらしいのですが。。。
> * [push – Broken pipe when pushing to git repository – Stack Overflow](http://stackoverflow.com/questions/19120120/broken-pipe-when-pushing-to-git-repository)
ありました。
> * [What kind of limits do you have on repository/file/upload size? – Bitbucket – Atlassian Documentation](https://confluence.atlassian.com/pages/viewpage.action;jsessionid=FDFE027B6BBC658AC4E15E6BF22EF228.node3?pageId=273877699)
後日、以下の対応も必要になりました。
> * [git repository size を削減する | deadwood](https://www.d-wood.com/blog/2014/10/03_6965.html)
[/markdown]