Centos7 Install the latest version of Git and password-free login configuration

Source: Internet
Author: User

First, install the latest version of Git

(1) Install dependent packages

# yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel# yum install gcc Perl-extutils-makemaker

(2) uninstall the old git version

# yum Remove git

(3) View latest git version number

Login https://www.kernel.org/pub/software/scm/git/

Current Latest version is 2.9.0

(4) Download & Unzip

# cd/usr/src# wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz# tar-zxvf git-2.9.0.tar.gz

(5) compile and install

# CD git-2.9.0# make prefix=/usr/local/git all# make Prefix=/usr/local/git install# echo "Export path= $PATH:/usr/local/gi T/bin ">>/etc/bashrc# SOURCE/ETC/BASHRC

(6) check git version

# git--versiongit version 2.9.0

Second, configure SSH password-free login

(1) Create a git user to run the GIT service

# AddUser git

(2) Initialize the Git repository, where we choose to create it in the/data/git/directory

# CD/# mkdir/data# CD data# mkdir/git# cd git# git init--bare xxxxx.git

(3) owner changed to git

# chown Git:git Xxxxx.git

(4) Open RSA authentication

A:

# Vim/etc/ssh/sshd_config

B: The corresponding content is modified as follows

1.RSAAuthentication Yes 2.PubkeyAuthentication Yes 3.AuthorizedKeysFile. Ssh/authorized_keys

(5) The client creates the secret key and the public key, which is used by Tortoisegit's own Puttygen

A: Click Generate and keep shaking the mouse until key is generated

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/83/64/wKiom1dyDsGgnMizAABnr3xZ_3g928.png-wh_500x0-wm_3 -wmp_4-s_2069053846.png "title=" Untitled. png "alt=" wkiom1dydsggnmizaabnr3xz_3g928.png-wh_50 "/>

B: Click Save Private Key, save the secret key to local, remember the location

C: Do not close the window. Later, you need to paste the contents of the key Red frame window into the authorized_keys of the GIT server.

Note that the content of the public key is the contents of the window here, not the contents of the generated file after save

(6) Create and configure Authorized_keys on a git server

A:authorized_keys location, many articles on the Internet, not clear, resulting in a configuration failure (after logging in or need to enter a password). The location of Authorized_keys is in: If you create a user username, that file should be created in/home/username/.ssh/authorized_keys, if you are using root user, the file should be created in ~/. Ssh/authorized_keys (i.e. Root/.ssh/authorized_keys).

This example creates a git user

B: Create a Authorized_keys file

# cd/home/git# mkdir ssh# vim Authorized_keys

Press "I" key, will just puttygen in the red window generated all the content, like paste in.

Press the "ESC" Key and enter ": Wq" to save the exit.

(7) Set permissions

# chmod 700/home# chmod 700/home/git# chmod 700/home/git/.ssh# chmod 600/home/git/.ssh/authorized_keys# chown Git/hom e# chown git/home/git# chown git/home/git/.ssh# chown Git/home/git/.ssh/authorized_keys

(8) test

A: Use the Tortoisegit connection test on the client, and if you do not enter a password, the configuration succeeds

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/83/63/wKioL1dyFAKz5Fx2AABBq0HpGiA147.png-wh_500x0-wm_3 -wmp_4-s_2151040111.png "title=" Untitled. png "alt=" wkiol1dyfakz5fx2aabbq0hpgia147.png-wh_50 "/>

B: If unsuccessful, you can use/usr/sbin/sshd-d to monitor the client SSH connection on the GIT server to find the cause of the error

This article is from the "11356698" blog, please be sure to keep this source http://11366698.blog.51cto.com/11356698/1793600

Centos7 Install the latest version of Git and password-free login configuration

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.