aztfmod / rover

The rover is a docker container in charge of the deployment of the Terraform platform engineering for Azure
MIT License
171 stars 142 forks source link

postCreateCommand failed with exit code 1. Skipping any further user-provided commands. #250

Closed SipkeW closed 2 years ago

SipkeW commented 2 years ago

release: 2202.2503

Steps to reproduce

downloaded as zip, (https://github.com/aztfmod/rover/releases/tag/2202.2503) extracted to folder, opened in Win11 (build 22581.220318.1623) Using VsCode Version: 1.66.1 (user setup) And for the image: Docker Desktop 4.7.0 (77141) image: aztfmod/rover-preview 1.1.3-2201.190325 Just starting up the container triggers the error.

error message:

Start: Run in container: /bin/sh -c sudo cp -R /tmp/.ssh-localhost/* ~/.ssh && sudo chown -R $(whoami):$(whoami) /tf/caf ~/.ssh && sudo chmod 400 ~/.ssh/* && git config --global core.editor vi && pre-commit install && pre-commit autoupdate
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/vscode/.cache/pre-commit/pre-commit.log
[100430 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.

pre-commit.log:

version information

pre-commit version: 2.17.0
git --version: git version 2.32.0
sys.version:
    3.9.7 (default, Sep 10 2021, 14:59:43) 
    [GCC 11.2.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux

error information

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/git.py", line 59, in get_root
    cmd_output('git', 'rev-parse', '--show-cdup')[1].strip(),
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/util.py", line 160, in cmd_output
    returncode, stdout_b, stderr_b = cmd_output_b(*cmd, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/util.py", line 154, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/git', 'rev-parse', '--show-cdup')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: not a git repository (or any parent up to mount point /tf)
    Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/error_handler.py", line 70, in error_handler
    yield
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/main.py", line 351, in main
    _adjust_args_and_chdir(args)
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/main.py", line 168, in _adjust_args_and_chdir
    toplevel = git.get_root()
  File "/usr/local/lib/python3.9/dist-packages/pre_commit/git.py", line 63, in get_root
    raise FatalError(
pre_commit.errors.FatalError: git failed. Is it installed, and are you in a Git repository directory?
SipkeW commented 2 years ago

seems to occur when moving to another folder. Will try to figure it out

SipkeW commented 2 years ago

My own fault: was lazy and removed the .git folder