andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.18k stars 59 forks source link

user password for interactive sessions #130

Closed danipindado closed 1 year ago

danipindado commented 1 year ago

hi, i am tryining to use wslgit in a rather complex system, where my windows computer is running in a corporate network behind a vpn. so that the internet proxy works, there are some scripts which are executed when .bashrc and .profile are loaded, after login.

git is working fine from wsl side. but from windows, if i run for example wslgit clone https://my_repo_url

i get an unresolved error, 'fatal: unable to access https://my_repo_url'

this happens also if i set WSLGIT_USE_INTERACTIVE_SHELL

i have been playing around with the wsl command line. i have realized, that I get the error if i execute,

wsl -e bash -c 'curl www.google.com'
curl: (6) Could not resolve host: www.google.com

but it does work properly if i run it in a interactive session using option "-li" wsl -e bash -li -c 'curl www.google.com'

in this case, the proxy is started (when .bashrc and .profile are loaded), but i need to enter the password

...
Starting CNTLM Authentication Proxy: cntlm.
...
[sudo] password for username:
...
<!doctype html><html itemscope="" 
...

my feeling is that WSLGIT_USE_INTERACTIVE_SHELL cannot deal with a wsl account with a non empty password ? can you figure out a way to use wslgit in my system? thanks

andy-5 commented 1 year ago

This is a tricky setup, which, I think, is currently not supported by wslgit.

Setting WSLGIT_USE_INTERACTIVE_SHELL should not be required, as commands accessing the network (e.g. clone, pull, ...) use an interactive shell by default.

But wslgit expects all output to be from Git! Any additional output from shell startup scripts, or password prompts, is not supported.

Is there a way you could setup the proxy manually once and "inherit" the configuration in new shells? Similar to ssh-agent, for which some state is typically stored in environment variables, so that subsequent shells can reuse the already running agent.

danipindado commented 1 year ago

thank you @andy-5 for the prompt answer. ok, i will look into this. we are not using a ssh-agent. but will try to figure out how to make the connection available.