我們有一個帶有 .Net 解決方案的現有 git 存盤庫。我們正在添加一個 Web 應用程式。Web 應用程式(角度)位于特定的子檔案夾中。
我們確實安裝了一些 pre-post 提交掛鉤,以確保檔案被正確 linted。使用 VS 代碼或源代碼樹提交時一切正常。但是當我嘗試直接從 Visual Studio 提交某些內容時,我收到了這個錯誤:
/usr/bin/env: 'bash': No such file or directory
有沒有辦法讓它作業?
作為參考,這是我的鉤子:
結帳后
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-checkout'.\n"; exit 2; }
git lfs post-checkout "$@"
提交后
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-commit'.\n"; exit 2; }
git lfs post-commit "$@"
合并后
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/post-merge'.\n"; exit 2; }
git lfs post-merge "$@"
cd ./Src/Frontend
npx git-pull-run --pattern "package-lock.json" --command "npm install"
預提交
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd ./Src/Frontend
npm run lint
預推
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.\n"; exit 2; }
git lfs pre-push "$@"
必須有一種方法來使用 pre/post 提交鉤子,同時仍然能夠在 VS Code 和 VS 中提交,對吧?我該怎么辦?
uj5u.com熱心網友回復:
檢查您的%PATH%第一個,其中應包括C:\Program Files\Git\bin,bash.exe居住在哪里。
或者修改shebang指令以進行測驗:
#!C:/Program\ Files/Git/git-bash.exe
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/471774.html
