前提・実現したいこと
GithubDesktopでのコミットを成功させたいです。
railsでアプリを開発しています。
.gitignoreを編集しGithubDesktopでコミットをしようとしたら以下のエラーが発生しました。
LinterとしてRuboCopとovercommitを導入したのですが、今回のエラーとしてそれらが関係していると思われます。
編集内容としては画像ファイルがコミットされないようにpublic/uploads/*と記載しました。
発生している問題・エラーメッセージ
Commit failed - exit code 1 received, with output: 'Running pre-commit hooks ✓ All pre-commit hooks passed Running commit-msg hooks Check subject line................................[SingleLineSubject] OK Check for trailing periods in subject................[TrailingPeriod] OK Check text width..........................................[TextWidth] FAILED Hook raised unexpected error invalid byte sequence in US-ASCII /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/text_width.rb:53:in `match' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/text_width.rb:53:in `match' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/text_width.rb:53:in `special_prefix_length' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/text_width.rb:25:in `find_errors_in_subject' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/text_width.rb:12:in `run' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/base.rb:47:in `block in run_and_transform' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/utils.rb:260:in `with_environment' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/base.rb:47:in `run_and_transform' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:161:in `run_hook' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:97:in `block in consume' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:94:in `loop' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:94:in `consume' Check subject capitalization.....................[CapitalizedSubject] FAILED Hook raised unexpected error invalid byte sequence in US-ASCII /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/capitalized_subject.rb:11:in `match' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/capitalized_subject.rb:11:in `match' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/commit_msg/capitalized_subject.rb:11:in `run' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/base.rb:47:in `block in run_and_transform' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/utils.rb:260:in `with_environment' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook/base.rb:47:in `run_and_transform' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:161:in `run_hook' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:97:in `block in consume' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:94:in `loop' /Users/iwanabekiyoshiya/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.57.0/lib/overcommit/hook_runner.rb:94:in `consume' ✗ One or more commit-msg hooks failed Failed commit message: 画像ファイルについて 画像ファイルがコミットされないようにpublic/uploadsディレクトリを.gitignoreに追加 Try again with your existing commit message by running: git commit --edit --file=.git/COMMIT_EDITMSG'
該当のソースコード
《.gitignore》
# See https://help.github.com/articles/ignoring-files for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' # Ignore bundler config. /.bundle # Ignore all logfiles and tempfiles. /log/* /tmp/* !/log/.keep !/tmp/.keep # Ignore uploaded files in development. /storage/* !/storage/.keep /public/assets .byebug_history # Ignore master key for decrypting credentials and more. /config/master.key /public/packs /public/packs-test /node_modules /yarn-error.log yarn-debug.log* .yarn-integrity public/uploads/*
補足情報(FW/ツールのバージョンなど)
開発環境
Mac OS Catalina
Rubyバージョン2.6.5
Ruby on railsバージョン6.0
あなたの回答
tips
プレビュー