2

I'm using Windows 7. My company has some repos stored on our own git server. Recently I also had to use GitHub, but ever since I've accessed the repo that's on GitHub, git-bash has been acting really wonky.

What it all boils down to is that every time I open git-bash, if I try do a pull, I get: "error: cannot span git: No such file or directory."

My git version is 2.18.0.windows.1

I've found that I manually have to execute this command every time I launch git-bash:

eval $(ssh-agent)

I've tried using the info here: Start ssh-agent on login

And here: https://help.github.com/articles/working-with-ssh-key-passphrases/#auto-launching-ssh-agent-on-git-for-windows

My .profile consists of the following:

env=~/.ssh/agent.env

agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }

agent_start () {
    (umask 077; ssh-agent >| "$env")
    . "$env" >| /dev/null ; }

agent_load_env

# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)

if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
    agent_start
    ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
    ssh-add
fi

unset env

But nope...I still need to manually execute that command whenever I start git -bash. (And the above code is supposed to quash that necessity.)

Cœur
  • 32,421
  • 21
  • 173
  • 232
dauber
  • 311
  • 3
  • 17

1 Answers1

0

Both of those links suggests adding that in .bash_profile or .bashrc (see "What are the functional differences between .profile .bash_profile and .bashrc")

Try that first, instead of using .profile.

Make sure your git bash does echo $HOME to the expected value: set HOME first to %USERPROFILE%.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I added that to all three - .profile, .bash_profile, and .bashrc. No difference. echo $HOME is reflecting the correct value. – dauber Jul 02 '18 at 14:31
  • @dauber "`cannot span git: No such file or directory.`": is git in your `$PATH` once the bash is opened? Does a `which git` returns something? – VonC Jul 02 '18 at 15:02