0

I am working on a shell script performing recurring tasks of

  • git commit
  • git push
  • mvn release:prepare
  • mvn release:perform

in a couple of paths of a JAVA software project.

Now each of these commands asks for my rsa token password at least once, sometimes even multiple times: "Enter passphrase for key /..../.ssh/id_rsa:"

Is there a way to get around this? It would be OK if I had to enter the password once per script execution.

One boundary condition: I cannot use "spawn, expect, send"

A complication: I run the script in a CENTOS7 shell which is called on a windows10 machine via X-Win32. I would not like to log on to the native Linux Desktop environment.

Note: this is a copy of the same question which I posted in askubuntu - which was an off topic (https://askubuntu.com/questions/1178707/how-to-avoid-neccessity-to-re-enter-password-during-schell-script-execution)

1 Answer 1

0

Use ssh-agent.

It's quite possible that you already have it running on your system. Try adding your key to the agent using this command:

ssh-add 

If ssh-agent is not running you will get the following message:
"Could not open a connection to your authentication agent."

To fix that use:

eval $(ssh-agent) 

Then run the ssh-add command again.

Here is the ssh agent manpage.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.