I had problems getting the example to run in my own code, constantly getting error authenticating:. Checked out the project (revision 5d371ae0) and ran the tests (quit after finishing the Clone tests).
✓ can clone with http (4566ms)
✓ can clone with https (4469ms)
1) can clone with ssh
✓ can clone with ssh while manually loading a key (13553ms)
✓ can clone with git (3616ms)
^C
15 passing (32s)
1 failing
1) Clone can clone with ssh:
Error: error authenticating:
This fails on both Ubuntu 14.10 and on OS X 10.10.
Actually the error on Linux is more verbose:
1) Clone can clone with ssh:
Error: error authenticating: no auth sock variable
I have made sure to start ssh-agent and verified at socket has been created at SSH_AUTH_SOCK.
Hey @fatso83 I'm not entirely sure why that's failing for you. I use Linux as my primary OS and I've never had a clone test failure like that. You'll also notice we continuously test on Travis-CI which is also Linux and the tests pass fine there.
I'd look more into your system setup, since agents can be tricky to get right. I'm hesitant to blame NodeGit at this point.
And you've verified that the environment variable SSH_AUTH_SOCK is set?
@maxkorp : actually that was a good point, as I had just checked that the advertised socket was present. I thought explicitly running ssh-agent set up the environment variable for me:
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-QejtRVwKAexV/agent.21239; export SSH_AUTH_SOCK;
SSH_AGENT_PID=21240; export SSH_AGENT_PID;
echo Agent pid 21240;
Turned out I was wrong
printenv|grep SSH_AUTH_SOCK # gave me empty on Linux, was set on OS X
Anyway, after setting the environment variable on Linux (and checking it was present by echoing it) I got the same error message as on OS X.
1) Clone can clone with ssh:
Error: error authenticating
Any way I can check this is just my environment pulling tricks? I tried this on two different setups, so I thought I had it verified, but if the CI tests still run ...
I just pulled latest and tried again with my machine, and it works as expected. Unfortunately unless we can reproduce a bug in our CI environment, we have to chalk this up to environmental error.
Ensure you have something like this in your enivornment runtime configuration file, like .bashrc:
# SSH Agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
Please open a PR with a failing test case, and we'll be happy to work with you to resolve.
@tbranyen
perfect! It's work!
@tbranyen good job!
Most helpful comment
I just pulled latest and tried again with my machine, and it works as expected. Unfortunately unless we can reproduce a bug in our CI environment, we have to chalk this up to environmental error.
Ensure you have something like this in your enivornment runtime configuration file, like
.bashrc:Please open a PR with a failing test case, and we'll be happy to work with you to resolve.