我们有一个现有的带有 .Net 解决方案的 git 仓库。我们正在将 web 应用程序添加到其中。web 应用程序(angular)在特定的子文件夹中。
我们安装了一些预先和后续提交钩子,以确保文件被正确地检查。当使用 VS Code 或 Source Tree 提交时,一切正常。但当我尝试直接从 Visual Studio 提交某些内容时,我会收到以下错误:
/usr/bin/env: 'bash': No such file or directory
有没有办法让它起作用?
以下是我的钩子的参考:
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-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"
pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd ./Src/Frontend
npm run lint
pre-push
#!/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 "$@"
在使用VS Code和VS提交代码的同时,是否还有一种使用预/后提交挂钩的方法呢?我该怎么做?
C:\Program Files\Git\mingw64\libexec\git-core
,因为它包含用于 HTTPS 认证的git-credential-manager-core.exe
(来自 GCM 项目)。 - VonCgit bash
在Windows 10下无法执行vagrant version
”。 - VonC