How to do GIT auto enter password

How to do GIT auto enter password

Following are the steps to follow to avoid promoting the password (auto enter the SSH key password) while git cloning and committing the code.

1. Create a .bashrc file in your user profile folder (ex: C:Users/username)

To create a .bashrc file go to git bash and navigate to your user profile folder (ex: C:Users/username) and type the following command to create the file.
touch .bashrc

Now open the .bashrc file and update it with the following two lines of code
eval `ssh-agent`

2. Now open Git bash to clone the code. When you opened the git bash it will ask you to enter your SSH key password as following

Welcome to Git (version 1.8.4-preview20130916)

Run ‘git help git’ to display the help index.
Run ‘git help ‘ to display help for specific commands.
Agent pid 5768
Enter passphrase for /c/Users/username/.ssh/id_rsa:

Once you entered the password then it will store your ssh key password for the current session as following
Identity added: /c/Users/username/.ssh/id_rsa (/c/Users/username/.ssh/id_rsa)

That’s it you are done. Now you can clone and commit the code without promoting the password and it will be entered automatically whenever it is required.

Note: After setting above things when you opened the git bash for the first time it won’t add the identity in this case close and try it again, then it will add your identity for the current window

Comments 0

Your email address will not be published. Required fields are marked *

You may also like

More From: Automation Testing