Skip to content

GitPython subprocess doesn't pass the $HOME environment variable correctly #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sonicfly opened this issue Jan 7, 2015 · 4 comments
Closed

Comments

@sonicfly
Copy link

sonicfly commented Jan 7, 2015

When I try to push with GitPython, it always complain that my user.name, user.email and push.default is unset. I trace down and find when GitPython call git command through subprocess, the $HOME directory is not correctly set, the problem can be easily reproduce by following code segment.

_repo = git.repo.Repo(myRootPath)
_git = _repo.git
print(_git.config("-l","--global"))
@sonicfly sonicfly changed the title GitPython subprocess doesn't transfer the $HOME environment variable correctly GitPython subprocess doesn't pass the $HOME environment variable correctly Jan 7, 2015
@sonicfly
Copy link
Author

sonicfly commented Jan 7, 2015

Suggest to change line 347 of cmd.py to
env={"LC_MESSAGES": "C", "HOME": os.getenv("HOME")},

@Byron
Copy link
Member

Byron commented Jan 7, 2015

It's odd, as the environment starts out with a full copy of the initial environment. Looking at the different line numbers, it may be you are not using the latest version ?

What does git.__version__ say ?

@sonicfly
Copy link
Author

sonicfly commented Jan 7, 2015

Hmm, that's different from my local source, my version is 0.3.2.1. Seems like updating to latest should resolve this issue.

@sonicfly
Copy link
Author

sonicfly commented Jan 7, 2015

Confirmed the latest version fixed this issue already.

@sonicfly sonicfly closed this as completed Jan 7, 2015
mauritsvanrees added a commit to plone/buildout.coredev that referenced this issue Apr 22, 2015
release.cfg: do not pin own versions.  gitpython and PyGithub were
already pinned in tests.cfg.  PyGithub was more recent there.  And
GitPython was spelled with correct case there, the pin in release.cfg
was ignored.

Also use newer GitPython version.  Some are hit by this issue which is
solved in more recent versions:
gitpython-developers/GitPython#227

Update its dependencies, because the old pins were not compatible with
the new version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants