generated from just-the-docs/just-the-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
How do you guys do it these days?
I've tried a naive docker compose exec wca_on_rails bash -c "RAILS_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec overcommit --run", but it failed with:
Unable to determine location of GIT_DIR. Not a recognizable Git repository! (Overcommit::Exceptions::InvalidGitRepo)
Because the ownership in the mounted volume looks weird to git:
root@13d2792a7393:/app# git status
fatal: detected dubious ownership in repository at '/app'
To add an exception for this directory, call:
git config --global --add safe.directory /app
Running the suggested command let me ran the CI's overcommit commands, but expectedly it changes the .git/config file and sets the ownership to root (which is not what I would expect/like).
One of these must be true:
- you have an alternate way of running overcommit locally, and it would be great to document it :)
- you don't run overcommit locally and rely on the CI to tell when your code is wrong (:scream:)
- you do it the way I did, and in these cases I'd suggest to not use
rootas the container's user (using user id 1000 is better than nothing, but ideally we'd get the user id to use from the mounted volume)
Apart from that running overcommit the way I did mostly worked, even though it did complain about the commit information:
Running pre-commit hooks
Check for author name....................................[AuthorName] FAILED
Author name must be non-0 in length.
Set your name with `git config --global user.name "Your Name"` or via the GIT_AUTHOR_NAME environment variable
Check author email......................................[AuthorEmail] FAILED
Author has an invalid email address: ''
Set your email with `git config --global user.email your_email@example.com` or via the GIT_AUTHOR_EMAIL environment variable
(the commit information are actually correct, I think it may be confused because of the aforementioned difference in container/host users)
Metadata
Metadata
Assignees
Labels
No labels