Configuring git and ssh and using ssh-agent to store password using msysgit on Windows

Well, this is a pretty specific question, but I had some problems with this, so I decided to share my experience, so if someone else encounters the same problems, they can fix it a little faster.

Purpose: to use ssh-agent and msysgit for -a as safe as possible - to save the ssh key password so that there is no need to enter it for each git command with a remote repository

+4
source share
2 answers

1) Create a .bashrc in the user directory (the default window is C:\Users\UserName\ )
NOTES: if you think that you can just right-click in a directory in Windows Explorer and create a file called .bashrc , you (and I) are, unfortunately, mistaken, you will receive an error message "Explorer" preventing you from creating a file without name, So I did this from my git bash by doing echo 'blah' >> .bashrc so that I could get the file to edit in notepad to put the code in it.

2) Modify .bashrc in a text editor and place the code found here: https://help.github.com/articles/working-with-ssh-key-passphrases#platform-windows in the section "Autostart ssh-agent on msysgit"

3) restart bash.

TROUBLESHOOTING: ps will show all running processes. I found that when I tested this, I was not prompted to enter my password when starting bash. When I executed ps , I noticed a lot of running ssh agents. By killing everyone, I was able to restart git bash and it worked. Identification of this problem took me the longest.

+5
source

How about enabling pass in git repo-url:

 git clone http://username: password@example.com /git/Project.git . 

This is not a very safe solution, but it works :)

-4
source

Source: https://habr.com/ru/post/1434725/


All Articles