Closed rennex closed 5 years ago
I think it will be better if implemented like following snippet:
fn use_interactive_shell() -> bool {
// check for explicit environment variable setting
if let Ok(interactive_flag) = env::var("WSLGIT_USE_INTERACTIVE_SHELL") {
if interactive_flag == "false" || interactive_flag == "0" {
return false;
}
}
// check for advanced usage indicated by BASH_ENV and WSLENV=BASH_ENV
else if env::var("BASH_ENV").is_ok() {
if let Ok(wslenv) = env::var("WSLENV") {
if wslenv.split(':').position(|r| r.eq_ignore_ascii_case("BASH_ENV")).is_some() {
return false;
}
}
}
true
}
https://github.com/andy-5/wslgit/blob/master/src/main.rs#L96
I had to make this change to enable using ssh-agent which I have configured in
.bashrc
(according to GitHub's instructions, which I guess describes the common technique). This enables pushing to and pulling from remote repos using ssh keys, without leaving a passwordless ssh key on your disk.A simple
wsl some commands
in cmd.exe doesn't seem to make bash run.profile
,.bash_profile
, nor.bashrc
, so runningwsl bash -ic 'some commands'
looks like the only solution.These changes seemed to work for me, but feel free to re-think it, make it configurable, or something. But I think something like this needs to be implemented.