Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

ssh - Build Git server

I'm building my own git server on centos, I have done all these steps:

I add a new user named git and it's home is /home/git

and then I use ssh-keygen -t rsa to generate the .ssh

then I edit the /etc/ssh/sshd_config file to open the pub_key authorization :

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

then I git init --base in /srv/remote.git

finally I generate the id_rsa.pub on my client and copy it to my git server: /home/git/.ssh/authorized_keys

but when I git clone the repository : git@ip:/srv/remote.git

it always asks me to enter password, so why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In order to debug what is going on:

  • check the ssh sesion on the client:

    ssh -Tv git@ip
    
  • check the logs on the server (/var/log/auth.log)

  • check also the ssh daemon session to see what it does on the server when you do the ssh from the client (stop sshd, then restart it for a one-time connection with sshd -d)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...