Example of an SSH password connection under the GIT command line in Linux

Source: Internet
Author: User
Tags ssh


git command line, sometimes complete the graphics interface can not complete the work.

One, client configuration

1, generate public and private keys

# CD ~/.ssh

# ssh-keygen-t rsa-b 4096

generating public/private RSA key pair.

enter file in which to save the key (/HOME/TANK/.SSH/ID_RSA)://Custom file name, the following all the way to enter the line


2, add configuration file

# vim ~/.ssh/config

Host 192.168.10.202//git server

Hostname 192.168.10.202

User zhangying

Identityfile/home/tank/.ssh/zhangying//private key

Host 192.168.10.201//git service side

Hostname 192.168. 10.201


User zhangying
Identityfile/home/tank/.ssh/zhangying//Private key

Under Windows, the GIT command line can also be set as a sample. with Git bash.

# chmod ~/.ssh/config

This step is very important, otherwise it will be reported, bad owner or permissions on xxxxxxxx

3, install Git

# yum install-y git//install client

Second, put the public key on the GIT server

1, if used Gitlab, will. pub file in SSH directory open, content copy to Gitlab background SSH Key Management in the OK.
2, if used gitolite, login to git server, modify

# vim ~/.ssh/authorized_keys

command= "/home/git/bin/gitolite-shell zhangying", no-port-forwarding, No-x11-forwarding,no-agent-forwarding,no-pty

Here, the contents of the. pub file must be on one line


The zhangying behind the Gitolite-shell is the user name

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.