Rajalaxmi Agasti
Rajalaxmi Agasti

Reputation: 51

git rev-parse HEAD returned non-zero exit status 128

Facing this issue for git commit:

fatal: Not a git repository: '.git'
....
 File "C:\Repo\xyz\extern\VerFw\Src\ComponentLineImporter\__init__.py", line 28, in <module>
    from .Version import __version__
  File "C:\Repo\xyz\extern\VerFw\Src\ComponentLineImporter\Version.py", line 22, in <module>
    __version__ = subprocess.check_output('git rev-parse HEAD', cwd=os.path.dirname(os.path.abspath(__file__))).decode().strip()
  File "c:\program files\python36\lib\subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "c:\program files\python36\lib\subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'git rev-parse HEAD' returned non-zero exit status 128.

Why I get this error when there is no such duplicate folder of ComponentLineImporter in my only repo?

Upvotes: 3

Views: 12091

Answers (1)

Or b
Or b

Reputation: 816

You need to CD (change directory) to your git repository. You are either not in the correct path or you didn't create a git repository yet using create.

Make you your terminal is located under an existing git repository. using bash for instance you should see the name of your branch too.

for instance:

MINGW64 ~/../Source_code/pylint_Forked (master)
$

Upvotes: 5

Related Questions