Skip to content

Tell git to treat all directories as safe - #2586

Merged
gtback merged 1 commit into
masterfrom
gtback/fix-git-safe-directory
Dec 20, 2022
Merged

gtback merged 1 commit into
masterfrom
gtback/fix-git-safe-directory

Conversation

@gtback

@gtback gtback commented Dec 20, 2022

Copy link
Copy Markdown
Member

With a recent change to git 1, running commands like git rev-parse --show-toplevel will fail when different directories are owned by different users. Because of the complexity of how we use Docker and expect it to work across different operating systems, the easiest approach is to restore the prior behavior. 2

Rather than trying to run git config from within the build process (which runs into its own file permission errors depending on who is running the command), instead we just hardcode the "global" gitconfig file (which is located at the root of the Docker container).

With a recent change to git [1], running commands like `git rev-parse
--show-toplevel` will fail when different directories are owned by
different users. Because of the complexity of how we use Docker and
expect it to work across different operating systems, the easiest
approach is to restore the prior behavior. [2]

Rather than trying to run `git config` from within the build process
(which runs into its own file permission errors depending on who is
running the command), instead we just hardcode the "global" gitconfig
file (which is located at the root of the Docker container).

[1]: git/git@8959555
[2]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory
@gtback
gtback requested a review from bmorelli25 December 20, 2022 19:55

@bmorelli25 bmorelli25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not qualified to leave a review, but this PR works great locally for me 🚀

@trentm trentm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

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 this pull request may close these issues.

3 participants