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

Install fails with git error "fatal: unsafe repository" #47

Closed
brantleyp1 opened this issue Jun 21, 2022 · 1 comment · Fixed by #48
Closed

Install fails with git error "fatal: unsafe repository" #47

brantleyp1 opened this issue Jun 21, 2022 · 1 comment · Fixed by #48

Comments

@brantleyp1
Copy link

Tying to run the curl oneliner from the readme I get this:

  [✓] Running as root
  [✓] Package 'git' is installed
  [✓] Package 'sudo' is installed
  [✓] User 'labca' already exists
  [✓] Backup existing non-git directory '/home/labca/labca'
  [✓] Clone https://github.com/hakwerk/labca/ to /home/labca/labca
fatal: unsafe repository ('/home/labca/labca' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /home/labca/labca
fatal: unsafe repository ('/home/labca/labca' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /home/labca/labca

I've tried a few things, I've run that as the labca user, I've tried running the oneliner as labca, I've added labca to sudoers. All of those made no difference; it still results in the same unsafe repository.

Running the git config as the local user resulted in a different error:

  [✓] Running as root
  [✓] Package 'git' is installed
  [✓] Package 'sudo' is installed
  [✓] User 'labca' already exists
  [.] Update git repository in /home/labca/labca...
  Error: Could not update local repository

Which I can't quite understand why that would effect anything done as labca...

@brantleyp1
Copy link
Author

Forgot some env info, I'm seeing this on both fresh 20.04 and 18.04 installs. I tried both gjt-2.17.1-1ubuntu and git-2.17.0-1ubuntu per this SO answer but I saw no difference.

I managed a workaround but it's hacky. Running the install script locally and editing around, it looks like the issue is with some of the git calls.
particularly line 211:

TAG=$(git describe --tags $(git rev-list --tags --max-count=1))

I added sudo -u labca -H before any git describe and git rev-list calls but then had to comment out restart_if_updated on line 825 since I was using a local copy but the restart function uses the script from the downloaded repo. This got me to the finish line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant