Each time I need to use git for both my Linux server as well as my home computer running Windows 10, I need to start ssh-agent, then provide it with my GitHub RSA key, the problem being that doing so requires root privileges (i.e. entering the root password with each instance of needing to run ssh-add <keyname>). So within this I have three questions.

  1. My first question is, why is this needed for Git, but not for SSH connections or SSH copy programs?

  2. How do I make a single bash script that automatically starts the ssh-agent and adds all of my keys via ssh-add, even though those operations require passwords.

  3. How do I use the aforementioned script on the GitHub bash command line programs for Windows?

  • 2
    ssh-agent doesn't require root privileges.It may be started from the shell initialization scripts of any user.
    – Kusalananda
    Aug 3, 2016 at 19:46
  • I've edited the post to contain the correct information. Aug 3, 2016 at 23:18

1 Answer 1


You can try to write a script with this commands using piping like:

echo 'yourpassword' | ssh-add 

but it's not safe enough and not recommended.

You can use git tools to remember passwords both on Linux and Windows

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .