Skip to content

Working with a repository that has a different working directory #1710

Open
@LevonX

Description

@LevonX

Hello!

I'm trying to use a repository that has been initialized like this:

mkdir git
mkdir work
git --git-dir=пit/test --work-tree=work/test init

But it doesn't work. For example, when requesting untracked_files I get the error:

    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git status --porcelain --untracked-files
  stderr: 'fatal: not a git repository (or any of the parent directories): .git

My code:

repo = Repo(repo_path)
print(repo.untracked_files())

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions