question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fatal: Not a git repository

See original GitHub issue

I am getting an error from the current version of this in one of the repos we are using it in.


 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.0.0
==> Detecting CI Provider
    No CI Detected. Using git/mercurial
fatal: Not a git repository (or any of the parent directories): .git
/bin/sh: hg: not found
child_process.js:635
    throw err;
    ^
Error: Command failed: git rev-parse --abbrev-ref HEAD || hg branch
fatal: Not a git repository (or any of the parent directories): .git
/bin/sh: hg: not found
    at checkExecSyncError (child_process.js:592:13)
    at execSync (child_process.js:632:13)
    at Object.branch ([redacted]/node_modules/codecov/lib/git.js:6:12)
    at Object.configuration ([redacted]/node_modules/codecov/lib/services/localGit.js:7:22)
    at detectProvider ([redacted]/node_modules/codecov/lib/detect.js:25:20)
    at Object.upload ([redacted]/node_modules/codecov/lib/codecov.js:229:13)
    at Object.<anonymous> ([redacted]/node_modules/codecov/bin/codecov:26:9)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

I am not sure if it is related to #1 or not. This happens on travis-ci run for a private repo. Its inside a docker container node v8.9.4 (npm v5.6.0) Docker version 17.06.0-ce, build 02c1d87

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

2reactions
ajkamelcommented, Jun 6, 2018

Based on testing on my production environment it looks like if you use Node 9 + (eg. mhart/alpine-node:9.11.1) it does not have git installed which might throw this error. Using a custom version of node in your Docker container that has git and hg might be helpful to fix this issue.

1reaction
DzmitryUcommented, Mar 31, 2020

Need to install git in docker like using “apt add git”

Also you need to copy or mount .git folder into your container

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving “Fatal: Not A Git Repository” (Or Any Of The Parent ...
This error means that you have some files that have been edited but not committed, and by checking out another branch, you'll overwrite...
Read more >
Git error - Fatal: Not a git repository and how to fix it | Datree.io
This error means you attempted to run a Git command, but weren't inside a Git repository. Make sure you've: ... Usually, this is...
Read more >
Not a git repository" when attempting to remote add a Git repo
Go to your source folder where local repo is stored , example mine is found in c:/GitSource , right click ...
Read more >
How to Fix the “fatal: not a git repository” Error - ContainIQ
In short, the fatal: not a git repository error indicates that your current working directory isn't tracked by Git. If you find yourself...
Read more >
fatal: not a git repository (or any of the parent directories): .git
The cause of this error message is running a Git command outside of a directory in which a Git folder is initialized. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found