Setting up git and ssh and using ssh-agent to store password with msysgit on Windows
Ok, this is a pretty specific question, but I had some challenges figuring it out so I figured I would share my experience so if anyone else runs into the same problems, they can fix it a little faster.
- Can I use ksdiff over ssh?
- Git pull from Bitbucket server
- Git push results in fatal: protocol error: bad line length character: This
- ssh not working, muxserver_listen bind(): No such file or directory
- can't push to github repo after replasing to another PC
- Gitlab prompts for git password when cloning a git repository
2 Solutions collect form web for “Setting up git and ssh and using ssh-agent to store password with msysgit on Windows”
1) Create a
.bashrc file in the user directory (default windows
NOTES: if you think you can just right click in the directory in Windows Explorer and create a file called
.bashrc you (and me) are sadly mistaken, you’ll get an error from Explorer preventing you from creating a file without a name. So, I did this from my git bash by executing
echo 'blah' >> .bashrc just so I could get the file to edit in notepad to put the required code in it.
.bashrc in a text editor and put the code found here: https://help.github.com/articles/working-with-ssh-key-passphrases#platform-windows under “Auto-launching ssh-agent on msysgit”
3) restart bash.
ps will show all running processes. I found that when I was testing this out, it wasn’t prompting me to put in my password when bash was started. When I executed
ps I noticed many ssh-agents running. After killing them all, I was able to restart git bash and everything worked. Identifying this problem took me the longest.
What about to include pass in git repo-url:
git clone http://username:firstname.lastname@example.org/git/Project.git .
It’s not very safe solution, but works 🙂