Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GIT_DIR is ignored #1977

Open
Open
@obeidahmad

Description

@obeidahmad

Version 3.1.43

Description:

I am trying to create or open a repo while also changing the .git default path to custom name like .custom_git. However, I a meeting an exception.

Example Code

from pathlib import Pathimport gitrepo_path = Path("my_repo")custom_git_dir = Path(".custom_git")os.environ["GIT_DIR"] = str(custom_git_dir)repo = git.Repo.init(repo_path)

Error

Traceback (most recent call last):  File "pythonProject\main.py", line 11, in <module>    repo = git.Repo.init(repo_path)           ^^^^^^^^^^^^^^^^^^^^^^^^  File "pythonProject\.venv\Lib\site-packages\git\repo\base.py", line 1329, in init    return cls(path, odbt=odbt)           ^^^^^^^^^^^^^^^^^^^^  File "pythonProject\.venv\Lib\site-packages\git\repo\base.py", line 289, in __init__    raise InvalidGitRepositoryError(epath)git.exc.InvalidGitRepositoryError: pythonProject\temp

The directory.custom_git gets created but the error happens. The same exception is raised when trying git.Repo(repo_path) instead of initialization with .innit(repo_path).

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp