简体   繁体   中英

Can't match ssh key for git. Makes local fingerprint instead?

My target is to set up git on my Linux server box so I can commit/push through a batch file from my windows machine. I was hoping for something similar to how I did it with svn in the past, such that I could create a user that had certain read/write privileges. I am more than happy for it to be ssh key dependant. Thus far every time I try to put an ssh key on my computer and on the server, it just ignores it and makes its own:

The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Are you sure you want to continue connecting (yes/no)?

And this means I have to insert a password every time so my batch file solution won't work.

I placed the key on my windows machine both in "C:/Users/Ryan/.ssh/" and "C:/Program Files (x86)/Git/.ssh/" in the msysgit installation directory. I also installed it onto my server to the suggested git user. I did the basic installation following the git documentation : - Generated myself an SSH key using puttygen. - Copied it to my server and cat'd it to authorized_keys in /home/git/.ssh/ - Init'd bare git repository etc.

I can push/pull but I have to use the RSA fingerprint and use the git account password to log in rather than using an ssh key.

Am I doing something wrong is it actually supposed to work like this?

I haven't fully read into making a git daemon instead, perhaps that is what I am after?

Make sure you are starting a DOS session with git-cmd.bat from your msysgit distribution: that will set the HOME environment variable properly (usually %USERPROFILE% ).

The public ( id_rsa.pub ) and private ( id_rsa ) keys need to be in %HOME%\\.ssh .

The message The authenticity of host should only occurs one, at the first ssh connection. Once it is done, don't delete the %HOME%\\.ssh\\known_hosts file it has created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM