pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

Error, Repository not found

Open zdaiot opened this issue 2 years ago • 3 comments

Suppose the git directory is repos/v8.

When the ownership of repos/v8 is test:test, initialize the repository with Python under root authority. Prompt error: _ pygit2.GitError: Repository not found at repos/v8/ .git.

When using the command chown-R test:test repos/ v8, initializing the repository with Python under root permission will not cause an error.

What is the reason for this, please?

zdaiot avatar Feb 28 '23 06:02 zdaiot

_pygit2.GitError: Repository not found at 
pygit2.repository.Repository("/srv/git/repositories/rpmspec/nodejs-electron.git", pygit2.GIT_REPOSITORY_OPEN_BARE)

Cell In [42], line 1
----> 1 a = pygit2.repository.Repository("/srv/git/repositories/rpmspec/nodejs-electron.git", pygit2.GIT_REPOSITORY_OPEN_BARE)

File /usr/lib64/python3.11/site-packages/pygit2/repository.py:1620, in Repository.__init__(self, path, flags)
1618     if not isinstance(path, str):
1619         path = path.decode('utf-8')
-> 1620     path_backend = init_file_backend(path, flags)
1621     super().__init__(path_backend)

what is the problem ? ls /srv/git/repositories/rpmspec/nodejs-electron.git/ config description git-daemon-export-ok HEAD hooks/ info/ objects/ refs/

I'm using Fedora 37 with libgit2 1.3.2

sergiomb2 avatar Mar 10 '23 12:03 sergiomb2

I think I got the answer

It is the "Ownership check" since an early version when we run repo = Repository('.') we need to run with same user of the ownership of the directory

sergiomb2 avatar Apr 23 '23 15:04 sergiomb2

@sergiomb2 Thank you. Has the latest version solved this problem?

zdaiot avatar Apr 24 '23 03:04 zdaiot