Repository: pre-commit/pre-commit

Issue:
command: `go install` fails with: error obtaining VCS status: exit status 128 while installing check
### search you tried in the issue tracker

error obtaining VCS status: exit status

### describe your issue

I was just running the pre-commit checks. It looks like the failures started after the update.

```shell
git commit -am "My ultimate commit"
```

Output:
```
[INFO] Installing environment for https://github.com/stackrox/kube-linter.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/opt/homebrew/bin/go', 'install', './...')
return code: 1
stdout: (none)
stderr:
    go: downloading github.com/fatih/color v1.13.0
    go: downloading github.com/Masterminds/sprig/v3 v3.2.3
    go: downloading github.com/pkg/errors v0.9.1
    ...
    go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
```

I have also tried to run: `pre-commit clean` but it did not help.

### pre-commit --version

pre-commit 3.0.0

### .pre-commit-config.yaml

```yaml
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-added-large-files
      - id: check-merge-conflict
      - id: detect-aws-credentials
        args:
          - "--allow-missing-credentials"
      - id: detect-private-key
      - id: end-of-file-fixer
      - id: mixed-line-ending
      - id: trailing-whitespace
  - repo: https://github.com/stackrox/kube-linter
    rev: 0.5.1
    hooks:
      - id: kube-linter
        args: [lint, --config, .kube-linter.yaml]
  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.28.0
    hooks:
      - id: yamllint
        args: [-c=.yamllint]
  - repo: https://github.com/Yelp/detect-secrets
    rev: v1.4.0
    hooks:
      - id: detect-secrets
        args:
          [
            "--disable-plugin",
            "KeywordDetector",
            "--baseline",
            ".secrets.baseline",
          ]
        exclude: package.lock.json
```


### ~/.cache/pre-commit/pre-commit.log (if present)

### version information

```
pre-commit version: 3.0.0
git --version: git version 2.39.1
sys.version:
    3.11.1 (main, Dec 23 2022, 09:28:24) [Clang 14.0.0 (clang-1400.0.29.202)]
sys.executable: /opt/homebrew/Cellar/pre-commit/3.0.0/libexec/bin/python3
os.name: posix
sys.platform: darwin
```

### error information

```
An unexpected error has occurred: CalledProcessError: command: ('/opt/homebrew/bin/go', 'install', './...')
return code: 1
stdout: (none)
stderr:
    go: downloading github.com/fatih/color v1.13.0
    go: downloading github.com/Masterminds/sprig/v3 v3.2.3
    go: downloading github.com/pkg/errors v0.9.1
    go: downloading github.com/ghodss/yaml v1.0.0
    go: downloading github.com/spf13/cobra v1.6.1
    go: downloading github.com/spf13/pflag v1.0.5
    go: downloading github.com/owenrumney/go-sarif/v2 v2.1.2
    go: downloading github.com/spf13/viper v1.14.0
    go: downloading github.com/openshift/api v3.9.0+incompatible
    go: downloading k8s.io/apimachinery v0.25.4
    go: downloading k8s.io/api v0.25.4
    go: downloading github.com/stretchr/testify v1.8.1
    go: downloading helm.sh/helm/v3 v3.10.2
    go: downloading k8s.io/gengo v0.0.0-20211129171323-c02415ce4185
    go: downloading k8s.io/client-go v0.25.4
    go: downloading github.com/mitchellh/mapstructure v1.5.0
    go: downloading gopkg.in/yaml.v2 v2.4.0
    go: downloading github.com/mattn/go-colorable v0.1.13
    go: downloading github.com/mattn/go-isatty v0.0.16
    go: downloading github.com/Masterminds/goutils v1.1.1
    go: downloading github.com/Masterminds/semver/v3 v3.2.0
    go: downloading github.com/google/uuid v1.3.0
    go: downloading github.com/huandu/xstrings v1.3.3
    go: downloading github.com/imdario/mergo v0.3.12
    go: downloading github.com/mitchellh/copystructure v1.2.0
    go: downloading github.com/shopspring/decimal v1.2.0
    go: downloading github.com/spf13/cast v1.5.0
    go: downloading golang.org/x/crypto v0.3.0
    go: downloading github.com/Masterminds/semver v1.5.0
    go: downloading github.com/fsnotify/fsnotify v1.6.0
    go: downloading github.com/spf13/afero v1.9.2
    go: downloading github.com/spf13/jwalterweatherman v1.1.0
    go: downloading github.com/gogo/protobuf v1.3.2
    go: downloading github.com/google/gofuzz v1.2.0
    go: downloading k8s.io/klog/v2 v2.80.1
    go: downloading sigs.k8s.io/structured-merge-diff/v4 v4.2.3
    go: downloading k8s.io/utils v0.0.0-20220922133306-665eaaec4324
    go: downloading sigs.k8s.io/yaml v1.3.0
    go: downloading gopkg.in/inf.v0 v0.9.1
    go: downloading github.com/BurntSushi/toml v1.2.1
    go: downloading github.com/gobwas/glob v0.2.3
    go: downloading github.com/cyphar/filepath-securejoin v0.2.3
    go: downloading github.com/xeipuuv/gojsonschema v1.2.0
    go: downloading k8s.io/apiextensions-apiserver v0.25.2
    go: downloading golang.org/x/sys v0.2.0
    go: downloading github.com/mitchellh/reflectwalk v1.0.2
    go: downloading github.com/subosito/gotenv v1.4.1
    go: downloading github.com/hashicorp/hcl v1.0.0
    go: downloading gopkg.in/ini.v1 v1.67.0
    go: downloading github.com/magiconair/properties v1.8.6
    go: downloading github.com/pelletier/go-toml/v2 v2.0.5
    go: downloading gopkg.in/yaml.v3 v3.0.1
    go: downloading sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
    go: downloading golang.org/x/text v0.4.0
    go: downloading github.com/davecgh/go-spew v1.1.1
    go: downloading github.com/pmezard/go-difflib v1.0.0
    go: downloading github.com/go-logr/logr v1.2.3
    go: downloading github.com/golang/protobuf v1.5.2
    go: downloading github.com/pelletier/go-toml v1.9.5
    go: downloading github.com/google/gnostic v0.6.9
    go: downloading golang.org/x/net v0.2.0
    go: downloading github.com/json-iterator/go v1.1.12
    go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
    go: downloading k8s.io/cli-runtime v0.25.4
    go: downloading github.com/containerd/containerd v1.6.6
    go: downloading github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
    go: downloading github.com/sirupsen/logrus v1.9.0
    go: downloading oras.land/oras-go v1.2.0
    go: downloading google.golang.org/protobuf v1.28.1
    go: downloading k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea
    go: downloading golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783
    go: downloading golang.org/x/term v0.2.0
    go: downloading golang.org/x/time v0.0.0-20220609170525-579cf78fd858
    go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
    go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f
    go: downloading github.com/modern-go/reflect2 v1.0.2
    go: downloading github.com/evanphx/json-patch v5.6.0+incompatible
    go: downloading github.com/opencontainers/go-digest v1.0.0
    go: downloading github.com/docker/cli v20.10.17+incompatible
    go: downloading github.com/docker/distribution v2.8.1+incompatible
    go: downloading golang.org/x/sync v0.1.0
    go: downloading github.com/docker/docker v20.10.17+incompatible
    go: downloading github.com/docker/go-connections v0.4.0
    go: downloading github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
    go: downloading github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
    go: downloading sigs.k8s.io/kustomize/api v0.12.1
    go: downloading sigs.k8s.io/kustomize/kyaml v0.13.9
    go: downloading github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
    go: downloading github.com/peterbourgon/diskv v2.0.1+incompatible
    go: downloading github.com/moby/locker v1.0.1
    go: downloading google.golang.org/grpc v1.50.1
    go: downloading github.com/emicklei/go-restful/v3 v3.8.0
    go: downloading github.com/docker/docker-credential-helpers v0.6.4
    go: downloading github.com/go-openapi/swag v0.19.14
    go: downloading github.com/go-openapi/jsonreference v0.19.5
    go: downloading github.com/google/btree v1.0.1
    go: downloading github.com/klauspost/compress v1.14.1
    go: downloading github.com/mailru/easyjson v0.7.6
    go: downloading github.com/PuerkitoBio/purell v1.1.1
    go: downloading github.com/go-openapi/jsonpointer v0.19.5
    go: downloading github.com/gorilla/mux v1.8.0
    go: downloading github.com/go-errors/errors v1.0.1
    go: downloading github.com/josharian/intern v1.0.0
    go: downloading google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
    go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
    go: downloading github.com/docker/go-metrics v0.0.1
    go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: downloading github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
    go: downloading github.com/xlab/treeprint v1.1.0
    go: downloading github.com/docker/go-units v0.4.0
    go: downloading github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
    go: downloading github.com/morikuni/aec v1.0.0
    go: downloading go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5
    go: downloading github.com/prometheus/client_golang v1.13.0
    go: downloading github.com/beorn7/perks v1.0.1
    go: downloading github.com/prometheus/common v0.37.0
    go: downloading github.com/cespare/xxhash/v2 v2.1.2
    go: downloading github.com/prometheus/client_model v0.2.0
    go: downloading github.com/prometheus/procfs v0.8.0
    go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    
```

```
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/main.py", line 366, in main
    return hook_impl(
           ^^^^^^^^^^
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/commands/hook_impl.py", line 254, in hook_impl
    return retv | run(config, store, ns)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/commands/run.py", line 436, in run
    install_hook_envs(to_install, store)
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/repository.py", line 239, in install_hook_envs
    _hook_install(hook)
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/repository.py", line 86, in _hook_install
    lang.install_environment(
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/languages/golang.py", line 152, in install_environment
    helpers.run_setup_cmd(prefix, ('go', 'install', './...'), env=env)
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/languages/helpers.py", line 49, in run_setup_cmd
    cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
  File "/opt/homebrew/Cellar/pre-commit/3.0.0/libexec/lib/python3.11/site-packages/pre_commit/util.py", line 115, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/opt/homebrew/bin/go', 'install', './...')
return code: 1
stdout: (none)
stderr:
    go: downloading github.com/fatih/color v1.13.0
    go: downloading github.com/Masterminds/sprig/v3 v3.2.3
    go: downloading github.com/pkg/errors v0.9.1
    go: downloading github.com/ghodss/yaml v1.0.0
    go: downloading github.com/spf13/cobra v1.6.1
    go: downloading github.com/spf13/pflag v1.0.5
    go: downloading github.com/owenrumney/go-sarif/v2 v2.1.2
    go: downloading github.com/spf13/viper v1.14.0
    go: downloading github.com/openshift/api v3.9.0+incompatible
    go: downloading k8s.io/apimachinery v0.25.4
    go: downloading k8s.io/api v0.25.4
    go: downloading github.com/stretchr/testify v1.8.1
    go: downloading helm.sh/helm/v3 v3.10.2
    go: downloading k8s.io/gengo v0.0.0-20211129171323-c02415ce4185
    go: downloading k8s.io/client-go v0.25.4
    go: downloading github.com/mitchellh/mapstructure v1.5.0
    go: downloading gopkg.in/yaml.v2 v2.4.0
    go: downloading github.com/mattn/go-colorable v0.1.13
    go: downloading github.com/mattn/go-isatty v0.0.16
    go: downloading github.com/Masterminds/goutils v1.1.1
    go: downloading github.com/Masterminds/semver/v3 v3.2.0
    go: downloading github.com/google/uuid v1.3.0
    go: downloading github.com/huandu/xstrings v1.3.3
    go: downloading github.com/imdario/mergo v0.3.12
    go: downloading github.com/mitchellh/copystructure v1.2.0
    go: downloading github.com/shopspring/decimal v1.2.0
    go: downloading github.com/spf13/cast v1.5.0
    go: downloading golang.org/x/crypto v0.3.0
    go: downloading github.com/Masterminds/semver v1.5.0
    go: downloading github.com/fsnotify/fsnotify v1.6.0
    go: downloading github.com/spf13/afero v1.9.2
    go: downloading github.com/spf13/jwalterweatherman v1.1.0
    go: downloading github.com/gogo/protobuf v1.3.2
    go: downloading github.com/google/gofuzz v1.2.0
    go: downloading k8s.io/klog/v2 v2.80.1
    go: downloading sigs.k8s.io/structured-merge-diff/v4 v4.2.3
    go: downloading k8s.io/utils v0.0.0-20220922133306-665eaaec4324
    go: downloading sigs.k8s.io/yaml v1.3.0
    go: downloading gopkg.in/inf.v0 v0.9.1
    go: downloading github.com/BurntSushi/toml v1.2.1
    go: downloading github.com/gobwas/glob v0.2.3
    go: downloading github.com/cyphar/filepath-securejoin v0.2.3
    go: downloading github.com/xeipuuv/gojsonschema v1.2.0
    go: downloading k8s.io/apiextensions-apiserver v0.25.2
    go: downloading golang.org/x/sys v0.2.0
    go: downloading github.com/mitchellh/reflectwalk v1.0.2
    go: downloading github.com/subosito/gotenv v1.4.1
    go: downloading github.com/hashicorp/hcl v1.0.0
    go: downloading gopkg.in/ini.v1 v1.67.0
    go: downloading github.com/magiconair/properties v1.8.6
    go: downloading github.com/pelletier/go-toml/v2 v2.0.5
    go: downloading gopkg.in/yaml.v3 v3.0.1
    go: downloading sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
    go: downloading golang.org/x/text v0.4.0
    go: downloading github.com/davecgh/go-spew v1.1.1
    go: downloading github.com/pmezard/go-difflib v1.0.0
    go: downloading github.com/go-logr/logr v1.2.3
    go: downloading github.com/golang/protobuf v1.5.2
    go: downloading github.com/pelletier/go-toml v1.9.5
    go: downloading github.com/google/gnostic v0.6.9
    go: downloading golang.org/x/net v0.2.0
    go: downloading github.com/json-iterator/go v1.1.12
    go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
    go: downloading k8s.io/cli-runtime v0.25.4
    go: downloading github.com/containerd/containerd v1.6.6
    go: downloading github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
    go: downloading github.com/sirupsen/logrus v1.9.0
    go: downloading oras.land/oras-go v1.2.0
    go: downloading google.golang.org/protobuf v1.28.1
    go: downloading k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea
    go: downloading golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783
    go: downloading golang.org/x/term v0.2.0
    go: downloading golang.org/x/time v0.0.0-20220609170525-579cf78fd858
    go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
    go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f
    go: downloading github.com/modern-go/reflect2 v1.0.2
    go: downloading github.com/evanphx/json-patch v5.6.0+incompatible
    go: downloading github.com/opencontainers/go-digest v1.0.0
    go: downloading github.com/docker/cli v20.10.17+incompatible
    go: downloading github.com/docker/distribution v2.8.1+incompatible
    go: downloading golang.org/x/sync v0.1.0
    go: downloading github.com/docker/docker v20.10.17+incompatible
    go: downloading github.com/docker/go-connections v0.4.0
    go: downloading github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
    go: downloading github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
    go: downloading sigs.k8s.io/kustomize/api v0.12.1
    go: downloading sigs.k8s.io/kustomize/kyaml v0.13.9
    go: downloading github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
    go: downloading github.com/peterbourgon/diskv v2.0.1+incompatible
    go: downloading github.com/moby/locker v1.0.1
    go: downloading google.golang.org/grpc v1.50.1
    go: downloading github.com/emicklei/go-restful/v3 v3.8.0
    go: downloading github.com/docker/docker-credential-helpers v0.6.4
    go: downloading github.com/go-openapi/swag v0.19.14
    go: downloading github.com/go-openapi/jsonreference v0.19.5
    go: downloading github.com/google/btree v1.0.1
    go: downloading github.com/klauspost/compress v1.14.1
    go: downloading github.com/mailru/easyjson v0.7.6
    go: downloading github.com/PuerkitoBio/purell v1.1.1
    go: downloading github.com/go-openapi/jsonpointer v0.19.5
    go: downloading github.com/gorilla/mux v1.8.0
    go: downloading github.com/go-errors/errors v1.0.1
    go: downloading github.com/josharian/intern v1.0.0
    go: downloading google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
    go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
    go: downloading github.com/docker/go-metrics v0.0.1
    go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: downloading github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
    go: downloading github.com/xlab/treeprint v1.1.0
    go: downloading github.com/docker/go-units v0.4.0
    go: downloading github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
    go: downloading github.com/morikuni/aec v1.0.0
    go: downloading go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5
    go: downloading github.com/prometheus/client_golang v1.13.0
    go: downloading github.com/beorn7/perks v1.0.1
    go: downloading github.com/prometheus/common v0.37.0
    go: downloading github.com/cespare/xxhash/v2 v2.1.2
    go: downloading github.com/prometheus/client_model v0.2.0
    go: downloading github.com/prometheus/procfs v0.8.0
    go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
    error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
```

Discussion:

Patch:
diff --git a/pre_commit/languages/golang.py b/pre_commit/languages/golang.py
index 4c13d8f..66e07cf 100644
--- a/pre_commit/languages/golang.py
+++ b/pre_commit/languages/golang.py
@@ -23,6 +23,7 @@ from pre_commit import lang_base
 from pre_commit.envcontext import envcontext
 from pre_commit.envcontext import PatchesT
 from pre_commit.envcontext import Var
+from pre_commit.git import no_git_env
 from pre_commit.prefix import Prefix
 from pre_commit.util import cmd_output
 from pre_commit.util import rmtree
@@ -141,7 +142,7 @@ def install_environment(
     else:
         gopath = env_dir
 
-    env = dict(os.environ, GOPATH=gopath)
+    env = no_git_env(dict(os.environ, GOPATH=gopath))
     env.pop('GOBIN', None)
     if version != 'system':
         env['GOROOT'] = os.path.join(env_dir, '.go')


Test patch:
diff --git a/tests/languages/golang_test.py b/tests/languages/golang_test.py
index 19e9f62..02e35d7 100644
--- a/tests/languages/golang_test.py
+++ b/tests/languages/golang_test.py
@@ -7,10 +7,16 @@ import re_assert
 
 import pre_commit.constants as C
 from pre_commit import lang_base
+from pre_commit.commands.install_uninstall import install
 from pre_commit.envcontext import envcontext
 from pre_commit.languages import golang
 from pre_commit.store import _make_local_repo
+from pre_commit.util import cmd_output
+from testing.fixtures import add_config_to_repo
+from testing.fixtures import make_config_from_repo
 from testing.language_helpers import run_language
+from testing.util import cmd_output_mocked_pre_commit_home
+from testing.util import git_commit
 
 
 ACTUAL_GET_DEFAULT_VERSION = golang.get_default_version.__wrapped__
@@ -134,3 +140,28 @@ def test_local_golang_additional_deps(tmp_path):
 def test_golang_hook_still_works_when_gobin_is_set(tmp_path):
     with envcontext((('GOBIN', str(tmp_path.joinpath('gobin'))),)):
         test_golang_system(tmp_path)
+
+
+def test_during_commit_all(tmp_path, tempdir_factory, store, in_git_dir):
+    hook_dir = tmp_path.joinpath('hook')
+    hook_dir.mkdir()
+    _make_hello_world(hook_dir)
+    hook_dir.joinpath('.pre-commit-hooks.yaml').write_text(
+        '-   id: hello-world\n'
+        '    name: hello world\n'
+        '    entry: golang-hello-world\n'
+        '    language: golang\n'
+        '    always_run: true\n',
+    )
+    cmd_output('git', 'init', hook_dir)
+    cmd_output('git', 'add', '.', cwd=hook_dir)
+    git_commit(cwd=hook_dir)
+
+    add_config_to_repo(in_git_dir, make_config_from_repo(hook_dir))
+
+    assert not install(C.CONFIG_FILE, store, hook_types=['pre-commit'])
+
+    git_commit(
+        fn=cmd_output_mocked_pre_commit_home,
+        tempdir_factory=tempdir_factory,
+    )