2
1

More than 1 year has passed since last update.

Windowsでgit-secretsを導入するとVisual Studioでコミットできなくなる問題の対応

Last updated at Posted at 2022-07-04

問題点

Windows環境でgit-secretsを導入すると、Git Bash上では問題なく動作しますが、Visual Studio上でコミットすると、/usr/bin/env: 'bash': No such file or directory というエラーが表示され、コミットできなくなります。
image.png

原因

git-secretsで利用しているスクリプトのシバンに#!/usr/bin/env bashが指定されているのが原因でした。

対策

git-secretsで利用しているスクリプトのシバンを#!/usr/bin/env bashから#!/bin/shに変更します。具体的には以下のファイルの先頭行を変更しました。

  • %USERPROFILE%\.git-secrets
  • (ローカルリポジトリのルート)\.git\hooks\commit-msg
  • (ローカルリポジトリのルート)\.git\hooks\pre-commit
  • (ローカルリポジトリのルート)\.git\hooks\prepare-commit-msg

参考

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