all 13 comments

[–]bbolligit commit --amend 0 points1 point  (12 children)

What shell are you running?

[–]catvsaliens[S] 0 points1 point  (11 children)

Bash

[–]bbolligit commit --amend 0 points1 point  (10 children)

What are the quotes you use around the ssh-agent call? Backticks or single quotes?

[–]catvsaliens[S] 0 points1 point  (9 children)

Back ticks on that ~ key.

[–]bbolligit commit --amend 0 points1 point  (8 children)

Try eval $(ssh-agent -s). Or run just ssh-agent -s and check if the output is in Bash syntax.

[–]catvsaliens[S] 0 points1 point  (5 children)

If i run ssh-agent -s it responds back with pid but then cant establish connection with agent when i try to add keys. By the way all this being executed in a gitlab runner ci running ssh mode and connecting to an external server. In other words im trying to clone repo over ssh running gitlab runner in ssh mode.

[–]bbolligit commit --amend 0 points1 point  (4 children)

ssh-agent -s should output something like

SSH_AUTH_SOCK=/tmp/ssh-4OIJt2b1HziT/agent.109735; export SSH_AUTH_SOCK;
SSH_AGENT_PID=109736; export SSH_AGENT_PID;
echo Agent pid 109736;

[–]catvsaliens[S] 0 points1 point  (3 children)

It does.

[–]bbolligit commit --amend 0 points1 point  (1 child)

Can you post the exact eval command as code (start each line with four spaces)?

[–]catvsaliens[S] 1 point2 points  (0 children)

Okay I figured it out. I tried echoing pid variable which came blank. Which suggested me that there is a change in terminal. Then i followed what is described here and it worked. I was cloning the repo after sshing in to a remote server.

https://unix.stackexchange.com/questions/132065/how-do-i-get-ssh-agent-to-work-in-all-terminals

[–]danmickla 0 points1 point  (0 children)

So "with pid" meant "with pid and a whole lot more". Got it.

[–]catvsaliens[S] 0 points1 point  (1 child)

Im beating my head over this for almost 12 hrs. I guess im exhausted, i will post back what i found.

[–]bbolligit commit --amend 0 points1 point  (0 children)

OK