Git“无效的Git存储库错误”

Was*_*tay 2 python git compiler-errors

我应该分析论文的结果,这里是提供的代码的链接https://github.com/xiat0616/pseudo-healthy-synthesis

在文件 run.py 中,我遇到以下错误:

Traceback (most recent call last):
  File "pseudo-healthy-synthesis/run.py", line 76, in <module>
    exper = experiment(comet_exp)
  File "pseudo-healthy-synthesis/run.py", line 17, in __init__
    self.repo = git.Repo(search_parent_directories=True)
  File "/usr/local/lib/python3.6/dist-packages/git/repo/base.py", line 181, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /content 
Run Code Online (Sandbox Code Playgroud)

该错误是由该指令生成的

git.Repo(search_parent_directories=True)
Run Code Online (Sandbox Code Playgroud)

这是我第一次在 python 中使用 Git,我不知道如何解决这个问题。(我使用的是gitpython-3.1.13)

小智 6

您需要将 git 存储库的路径添加到该git.Repo函数中:

git.Repo(repo, search_parent_directories=True)
Run Code Online (Sandbox Code Playgroud)