desktop / dugite

Elegant bindings for working with Git in your Node applications
MIT License
460 stars 149 forks source link

GitLFS does not handle GIT_TERMINAL_PROMPT env #385

Open chasse20 opened 4 years ago

chasse20 commented 4 years ago

Because git-lfs.exe (64bit) is spawned as a child process of git.exe, it appears to be incapable of inheriting the ENV variables that are passed into the exec function. This leads to zombie background processes/memory leaks for handling applications such as Github Desktop when you need to perform commands like git lfs locks asking for user authentication for HTTP repos. Github Desktop uses the GIT_TERMINAL_PROMPT=0 environment variable hack to avoid this for vanilla Git. It functions properly if authentication is provided.

A simple, albeit not the most efficient, solution is to perform an args.includes('lfs') check and have it handled differently.

chasse20 commented 4 years ago

Actually, this might not even be in Dugite's wheelhouse. GIT_TERMINAL_PROMPT isn't respected at all by git-lfs no matter what version I try when calling from Node. The ENV is all reading correctly, and the GIT_TERMINAL_PROMPT does work if I run tests in the shell, so I'm unsure what's going on there.

I'm expanding the LFS functionality for Github Desktop, so I'm a little uneasy about there being a leak . My short-term hack solution (aside from assuming people have credentials setup), is going to involve using the stdin from the spawner to force-fail any login prompt if credentials are set.