Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainer postCreateCommand fails #83753

Closed
RoboMagus opened this issue Dec 11, 2022 · 0 comments · Fixed by #83755
Closed

Devcontainer postCreateCommand fails #83753

RoboMagus opened this issue Dec 11, 2022 · 0 comments · Fixed by #83755

Comments

@RoboMagus
Copy link
Contributor

The problem

When starting up a clean environment for HA core development using VSCode DevContainers, I get the following error during the postCreate phase:

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
[81665 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.

What version of Home Assistant Core has the issue?

2022.12.x

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Here's the content of the log output during devcontainer startup:


vscode ➜ /workspaces/home-assistant-core $ cat /home/vscode/.cache/pre-commit/pre-commit.log
### version information


pre-commit version: 2.20.0
git --version: git version 2.38.1
sys.version:
    3.9.15 (main, Nov 15 2022, 21:37:24) 
    [GCC 10.2.1 20210110]
sys.executable: /usr/local/bin/python
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/site-packages/pre_commit/git.py", line 58, in get_root
    cmd_output('git', 'rev-parse', '--show-cdup')[1].strip(),
  File "/usr/local/lib/python3.9/site-packages/pre_commit/util.py", line 152, in cmd_output
    returncode, stdout_b, stderr_b = cmd_output_b(*cmd, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/util.py", line 146, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/local/bin/git', 'rev-parse', '--show-cdup')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: detected dubious ownership in repository at '/workspaces/home-assistant-core'
    To add an exception for this directory, call:
    
        git config --global --add safe.directory /workspaces/home-assistant-core
    

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/usr/local/lib/python3.9/site-packages/pre_commit/main.py", line 343, in main
    _adjust_args_and_chdir(args)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/main.py", line 161, in _adjust_args_and_chdir
    toplevel = git.get_root()
  File "/usr/local/lib/python3.9/site-packages/pre_commit/git.py", line 64, in get_root
    raise FatalError(
pre_commit.errors.FatalError: git failed. Is it installed, and are you in a Git repository directory?


### Additional information

I'm running on Windows without anything funky going on.

Looks like the fix should be straight forward. More problematic is that this can occur out of the box and the error message provided is not really all that usefull for newbie aspiring contributors.
@RoboMagus RoboMagus changed the title Devcontainer bootstrap script fails Devcontainer postCreateCommand fails Dec 11, 2022
frenck pushed a commit that referenced this issue Jan 7, 2023
rlippmann pushed a commit to rlippmann/core that referenced this issue Jan 18, 2023
SplinterHead pushed a commit to SplinterHead/core that referenced this issue Jan 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant