Create an instance based on the ssh protocol GIT server in Linux

Source: Internet
Author: User
1. SSH settings 1. On the client [root @ ethnicity ~] # Generatingpublicprivatersakeypair. Enterfileinwhichtosavethekey (root. sshid_rsa): Createddirectoryroot. ssh. Enterpassphrase (emptyfo

1. SSH settings

1. on the client

[Root @ ethnicity ~] # Ssh-keygen // generate public keys and keys

Generating public/private rsa key pair.

EnterFileInWhichTo save the key (/root/. ssh/Id_ Rsa ):

CreatEdDirectory '/root/. ssh '.

Enter passphrase (empty for no passphrase ):

Enter same passphrase again:

Your identifiCatIon has been saved in/root/. ssh/id_rsa.

Your public key has been saved in/root/. ssh/id_rsa.pub.

The keyFingerPrint is:

Af: 7a: 4c: de: 69: 7d: 5d: 4c: 74: 41: 2f: 4b: 9a: 9f: 69: 08 root @ ethnicity

[Root @ ethnicity ~] # SCp. Ssh/id_rsa.pub 192.168.1.193:/root // upload your public key to the server.

The authenticity of host' 192. 168.1.193 (192.168.1.193) 'can't be established.

RSA key fingerprint is 0a: 54: 06: f8: 28: 41: bd:Cd: Bd: e6: fa: AE: de: 56: 24: 78.

Are youSuRe you want to continue connecting (yes/no )? Yes

Warning: PeRmAnentlyDdEd '192. 168.1.193 '(RSA) to the list of known hosts.

Root@192.168.1.193's password:

Id_rsa.pub 100% 396 0.4KB/s

2. server-side settings

[Root @ wanyan ~] # Ssh-keygen // click "OK" without entering any information below

Generating public/private rsa key pair.

Enter file in which to save the key (/root/. ssh/id_rsa ):

Created directory '/root/. ssh '.

Enter passphrase (empty for no passphrase ):

Enter same passphrase again:

Your identification has been saved in/root/. ssh/id_rsa.

Your public key has been saved in/root/. ssh/id_rsa.pub.

The key fingerprint is:

07: 8f: af: 6b: 15: 9c: 7a: 9b: 7c: a8: 7e: 41: dd: bd: 1f: 56 root @ wanyan

[Root @ wanyan ~] # Cat id_rsa.pub>. ssh/authorized_keys // import the public key of the Client

Second: AboutGitInstallation and configuration

1. Public configuration on the server and client

[Root @ wanyan ~] #LsGit-1.7.7.4.tar.gz

Git-1.7.7.4.tar.gz

[Root @ wanyan ~] # Tar zxvf git-1.7.7.4.tar.gz

[Root @ wanyan ~] # Cd git-1.7.7.4

[Root @ wanyan git-1.7.7.4] #./configure

[Root @ wanyan git-1.7.7.4] # make & make install

[Root @ wanyan git-1.7.7.4] # cp conTrIb/completion/git-completion.bash ~ /. Git-completion.bash

[Root @ wanyan git-1.7.7.4] # vi ~ //. Bashrc // Add the following sentence

Source ~ /. Git-completion.bash

[Root @ wanyan git-1.7.7.4] # source ~ /. Bashrc

2. Only operations on the server

[Root @ wanyan ~] #Mkdir-P/opt/git/mygit

[Root @ wanyan mygit] # git -- bare init // create a "repository"

Initialized empty Git repository in/opt/git/mygit/

3. operations on the client

[Root @ ethnicity ~] # Mkdir/git

[Root @ ethnicity ~] # Cd/git/

[Root @ ethnicity git] # git init

Initialized empty Git repository in/git/. git/

[Root @ ethnicity git] # vim README

 

Hello ethnicitybeta!

[Root @ ethnicity git] # git add.

[Root @ ethnicity git] # git commit-m "1st commmit"

[Master (root-commit) e2810000f] 1st commmit

1 files changed, 1 insertions (+), 0 deletions (-)

Create mode 100644 README

[Root @ ethnicity git] # git remote add origin 192.168.1.193:/opt/git/mygit

[Root @ ethnicity git] # git push origin master // submit your modifications to the server

Counting objects: 3, done.

Writing objects: 100% (3/3), 221 bytes, done.

Total 3 (delta 0), reuSed0 (delta 0)

To 192.168.1.193:/opt/git/mygit

* [New braNcH] master-> master

Third: permission settings

Only authorized persons can browse and modify the settings, but not others.

[Root @ wanyan ~] #UseraddGit

[Root @ wanyan ~] # Vim/etc/Passwd

Git: x: 501: 501:/home/git:/bin/bash/git-shell

In this way, you can

Summary: git study notes.

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.