git server configuration in Linux environmentJump to: Navigation, search
Catalog [Hide]
- 1 Install Git-1.8.0 (server side & Client)
- 2 generate client SSH public key pair (can also be generated on the server side, and copy the key to the client for use?). )
- 3 Add the client key to the server side
- 4 server-side initialization code base
- 5 client initialization code base, and push to server side
- 6 execute git clone from another client to test the success of the push operation just now
|
[Edit]Install Git-1.8.0 (server side & Client)
- ./configure && make && sudo make install
[Edit]generate client SSH public key pair (can also be generated on the server side, and copy the key to the client for use?). )
- $ ssh-keygen-t RSA
-
do not enter a password, direct return to
-
generate id_rsa.pub (public key), Id_rsa (key) 2 files
[Edit]Add the client key to the server side
- The easy way: first copy the key file to the server side and then execute: $ cat id_rsa.pub >>/root/.ssh/authorized_keys
- can also be done at the Client a command:
- SSH [email protected] "cat >> ~/.ssh/authorized_keys" <./id_rsa.pub
- Cat Id_rsa.pub | SSH [email protected] "cat->> ~/.ssh/authorized_keys"
- Server-side configuration: chmod 0700/root/.ssh && chmod 0600/root/.ssh/authorized_keys
-
so the client SSH login will not need to lose password repeatedly
[Edit]server-side initialization code base
- $ cd/opt/repos/test.git && git--bare init
[Edit]client initialization code base, and push to server side
- $ cd my_working_dir && git init && git add readme.txt && git commit-m ' test '
- $ git Remote add origin [email protected]:/opt/repos/test.git
- $ GIT push origin master
[Edit]execute git clone from another client to test the success of the push operation just now
- $ git clone [email protected]:/opt/repos/test.git
Git server configuration in Linux environment