Article From:https://segmentfault.com/q/1010000011358586
Question:

1、The remote server has built up the warehouse.
2.The local clone needs to enter the password and enter the password pull push OK.
3.The local keygen is placed in /c/Users/hh/.ssh.
4.WINSCP Copy id_rsa.pub to server

5.The server is in Su GIT.
Building.Ssh under /home/git
6.Then cat id_rsa.pub > authorized_keys
7.chmod 700 .ssh
chmod 600 .ssh/authorized_keys

Server SSH configuration file
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Restart sshd service for above

AuthorizedKeysFile .ssh/authorized_keys It is not possible to restart /home/git/.ssh/authorized_keys service here.
But the remote connection still needs to enter the password.
Excuse me, God, that’s a mistake. Thank you.

Answer 0:

File owner error, modification is fine.

Answer 1:

Just add the local public key (id_rsa.pub) to the SSH keys in GIT.

Answer 2:

You try to delete the local HTTPS repository address.

git remote rm origin

Add another SSH repository address.

git remote add origin

Answer 3:

Open Git

vi ~/.ssh/config

Then write the following contents.

Host git.host.server
  User git
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes

The first line is the remote warehouse server address, the second line is stationary, the third line represents the private key file address, and the fourth line is stationary.

This will do.

Similar Posts:

Leave a Reply

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