René's URL Explorer Experiment


Title: pre-commit install-hooks should run without git tree · Issue #2378 · pre-commit/pre-commit · GitHub

Open Graph Title: pre-commit install-hooks should run without git tree · Issue #2378 · pre-commit/pre-commit

X Title: pre-commit install-hooks should run without git tree · Issue #2378 · pre-commit/pre-commit

Description: search tried in the issue tracker install-hooks describe your issue I want to build a docker container in which pre-commit hooks are already installed but running pre-commit install-hooks -c .pre-commit-config.yaml fails: An error has oc...

Open Graph Description: search tried in the issue tracker install-hooks describe your issue I want to build a docker container in which pre-commit hooks are already installed but running pre-commit install-hooks -c .pre-c...

X Description: search tried in the issue tracker install-hooks describe your issue I want to build a docker container in which pre-commit hooks are already installed but running pre-commit install-hooks -c .pre-c...

Opengraph URL: https://github.com/pre-commit/pre-commit/issues/2378

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pre-commit install-hooks should run without git tree","articleBody":"### search tried in the issue tracker\r\n\r\ninstall-hooks\r\n\r\n### describe your issue\r\n\r\nI want to build a docker container in which pre-commit hooks are already installed but running `pre-commit install-hooks -c .pre-commit-config.yaml` fails: `An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?`\r\n\r\nThere are various workarounds such as copying the .git directory inside the container or creating a temporary git repo but I think it's useful to just allow `install-hooks` to work with just a config file\r\n\r\n### pre-commit --version\r\n\r\npre-commit 2.19.0\r\n\r\n### .pre-commit-config.yaml\r\n\r\n```yaml\r\n# See https://pre-commit.com for more information\r\n# See https://pre-commit.com/hooks.html for more hooks\r\nrepos:\r\n  - repo: https://github.com/pre-commit/pre-commit-hooks\r\n    rev: v4.2.0\r\n    hooks:\r\n      - id: trailing-whitespace\r\n      - id: end-of-file-fixer\r\n      - id: check-yaml\r\n      - id: check-added-large-files\r\n```\r\n\r\n\r\n### ~/.cache/pre-commit/pre-commit.log (if present)\r\nAn error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?\r\nCheck the log at /root/.cache/pre-commit/pre-commit.log\r\n### version information\r\n\r\n```\r\npre-commit version: 2.19.0\r\ngit --version: git version 2.34.1\r\nsys.version:\r\n    3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]\r\nsys.executable: /usr/bin/python3\r\nos.name: posix\r\nsys.platform: linux\r\n```\r\n\r\n### error information\r\n\r\n```\r\nAn error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?\r\n```\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/git.py\", line 58, in get_root\r\n    cmd_output('git', 'rev-parse', '--show-cdup')[1].strip(),\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/util.py\", line 152, in cmd_output\r\n    returncode, stdout_b, stderr_b = cmd_output_b(*cmd, **kwargs)\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/util.py\", line 146, in cmd_output_b\r\n    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)\r\npre_commit.util.CalledProcessError: command: ('/usr/bin/git', 'rev-parse', '--show-cdup')\r\nreturn code: 128\r\nexpected return code: 0\r\nstdout: (none)\r\nstderr:\r\n    fatal: not a git repository (or any of the parent directories): .git\r\n\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/error_handler.py\", line 73, in error_handler\r\n    yield\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/main.py\", line 344, in main\r\n    _adjust_args_and_chdir(args)\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/main.py\", line 147, in _adjust_args_and_chdir\r\n    toplevel = git.get_root()\r\n  File \"/usr/local/lib/python3.10/dist-packages/pre_commit/git.py\", line 64, in get_root\r\n    raise FatalError(\r\npre_commit.errors.FatalError: git failed. Is it installed, and are you in a Git repository directory?\r\n```","author":{"url":"https://github.com/cdleonard","@type":"Person","name":"cdleonard"},"datePublished":"2022-05-06T10:25:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/2378/pre-commit/issues/2378"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0401d25a-de7a-3c92-4935-3ca45c42d2f8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB9A0:EB239:115D8E0:15F383F:69915DBD
html-safe-nonce385016775ee16ed4419108303c67baf1e51a6f1dd46d59fca729de4d99bcdbb1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUEwOkVCMjM5OjExNUQ4RTA6MTVGMzgzRjo2OTkxNURCRCIsInZpc2l0b3JfaWQiOiIyNDA5MjgzNjE3NTIyMDE1Njc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac492b73079ef9f47a16c8dca6d158d63eed954b7fc20d6445f0f5fee135fcb79e
hovercard-subject-tagissue:1227684640
github-keyboard-shortcutsrepository,issues,commits,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pre-commit/pre-commit/2378/issue_layout
twitter:imagehttps://opengraph.githubassets.com/17d542bb51b5993cd9c43a060a9b2bc53de8f73f33ddf56dd0b778d3e7087dfc/pre-commit/pre-commit/issues/2378
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/17d542bb51b5993cd9c43a060a9b2bc53de8f73f33ddf56dd0b778d3e7087dfc/pre-commit/pre-commit/issues/2378
og:image:altsearch tried in the issue tracker install-hooks describe your issue I want to build a docker container in which pre-commit hooks are already installed but running pre-commit install-hooks -c .pre-c...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecdleonard
hostnamegithub.com
expected-hostnamegithub.com
None42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b
turbo-cache-controlno-preview
go-importgithub.com/pre-commit/pre-commit git https://github.com/pre-commit/pre-commit.git
octolytics-dimension-user_id6943086
octolytics-dimension-user_loginpre-commit
octolytics-dimension-repository_id17689377
octolytics-dimension-repository_nwopre-commit/pre-commit
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id17689377
octolytics-dimension-repository_network_root_nwopre-commit/pre-commit
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release848bc6032dcc93a9a7301dcc3f379a72ba13b96e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pre-commit/pre-commit/issues/2378#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpre-commit%2Fpre-commit%2Fissues%2F2378
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpre-commit%2Fpre-commit%2Fissues%2F2378
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=pre-commit%2Fpre-commit
Reloadhttps://github.com/pre-commit/pre-commit/issues/2378
Reloadhttps://github.com/pre-commit/pre-commit/issues/2378
Reloadhttps://github.com/pre-commit/pre-commit/issues/2378
pre-commit https://github.com/pre-commit
pre-commithttps://github.com/pre-commit/pre-commit
Please reload this pagehttps://github.com/pre-commit/pre-commit/issues/2378
Notifications https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Fork 928 https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Star 15k https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Code https://github.com/pre-commit/pre-commit
Issues 20 https://github.com/pre-commit/pre-commit/issues
Pull requests 11 https://github.com/pre-commit/pre-commit/pulls
Actions https://github.com/pre-commit/pre-commit/actions
Security 0 https://github.com/pre-commit/pre-commit/security
Insights https://github.com/pre-commit/pre-commit/pulse
Code https://github.com/pre-commit/pre-commit
Issues https://github.com/pre-commit/pre-commit/issues
Pull requests https://github.com/pre-commit/pre-commit/pulls
Actions https://github.com/pre-commit/pre-commit/actions
Security https://github.com/pre-commit/pre-commit/security
Insights https://github.com/pre-commit/pre-commit/pulse
New issuehttps://github.com/login?return_to=https://github.com/pre-commit/pre-commit/issues/2378
New issuehttps://github.com/login?return_to=https://github.com/pre-commit/pre-commit/issues/2378
pre-commit install-hooks should run without git treehttps://github.com/pre-commit/pre-commit/issues/2378#top
https://github.com/cdleonard
https://github.com/cdleonard
cdleonardhttps://github.com/cdleonard
on May 6, 2022https://github.com/pre-commit/pre-commit/issues/2378#issue-1227684640
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.