RedHat git Server Installation
preparations before installation :
zlib, curl, rsync, libcrypto.
run the # rpm-Qa | grep zlib command to check the installation configuration.
1. download git-1.7.8.rc3.tar.gz
2. decompress the package and run
# configure -- prefix =/usr/local/git
# Make
# make install
3. add/usr/local/git/libexec/Git-core and/usr/local/git/bin to path
4. after the GIT software is installed, create the GIT repository
A) # cd repos-home
# Git-init-DB
if you want to create the bare directory, the directory name is usually. git end
# git -- bare init
B) Tracking file
Git-add and git-Update-index
C) submit a file
$ Git-commit-a-m "new day for git"
Windows git Client installation
Installation
because tortoisegit is an encapsulation of msysgit, therefore, before installing tortoisegit, you need to install msysgit
from fuse
download tortoisegit.msiand install it from http://code.google.com/p/tortoisegit.
select tortoiseplink for SSH connection,
Configure SSH intercommunication
the Code Of the GIT client and server must be uploaded using the SSH protocol, therefore, you need to configure two machines to support SSH key direct login.
A) create a git account on the Linux server for use by multiple users.
Create A. Ssh directory under/home/git (Note: It is. Ssh .. There is a point !)
chmod 700-R. Ssh
B) use c: \ Program Files \ git \ bin \ ssh-keygen-T RSA in Windows to Generate Keys and public keys, that is, id_rsa and id_rsa.pub.
C) Copy id_rsa.pub to the/home/git/. Ssh/file on the Linux server and add it to the authorized_keys file. If this file does not exist, you can create it as follows:
# Cat id_rsa.pub> authorized_keys
Change authorized_keys permission to 600
Modify/etc/ssh/sshd_config
Rsaauthentication yes # enable RSA Authentication
Pubkeyauthentication yes # enable Public Key Authentication
Authorizedkeysfile. Ssh/authorized_keys
D) test whether a password can be used to log on to the Linux server.
C: \ Program Files \ git \ bin \ ssh-I id_rsa root@192.168.6.131 echo $ path
E) convert to the public format to make tortoiseplink.exe available
Run c: \ Program Files \ tortoisegit \ bin \ puttygen.exe, select the Load button to load id_rsa, and save
Execute tortoiseplink.exe-I c: \ id_pri.ppk root@192.168.6.131 echo $ PATH test without password login
Clone a version library from the server
Right-click the Directory and choose Git-clone,
After cloning the version library from the server, you can start working in the working directory.
FAQs:
Q: Bash: Git-upload-pack command not found
A: This problem is caused by the failure to find Git-upload-pack in the server environment variable path.Program.
Unlike SSH interactive logon, environment variables in. bash_profile do not take effect after logon without a password. Therefore, you need to take the following steps.
Modify the sshd Process configuration file on Linux (generally/etc/ssh/sshd_config, please confirm With sshd-V ). Add the following configuration lines:
Permituserenvironment Yes
In addition, edit the generated file environment in the. Ssh directory. The content can be considered the same as. bash_profile, but export is not required.
Then restart the sshd daemon on the collector. Kill-HUP sshd
Now run the c: \ Program Files \ git \ bin \ ssh-I id_rsa root@192.168.6.131 echo $ path to check whether the PATH environment variable takes effect.
Common commands:
Initialize git Database
$ Git-init-DB
Add File
$ Git-add hello. c
View modification and submission records
$ Git-Log
Create Branch
$ Git-branch roredu
View Branch
$ Git-branch
* Master
Roredu
Switch Work Branch
$ Git-checkout roredu
Switched to branch "roredu"
$ Git-branch
Master
* Roredu
Submit to the current work branch and write the mark.
$ Git-commit-
Create xux branch patch files for the master.
$ Git-format-patch master roredu
Configure the developer's own signature and email.
$ Git-config -- global user. Name "roredu"
$ Git-config -- global user. Email "roredu@gmail.com"
Modify file name
$ Git-MV roredu. c helight. c
Delete an object
$ Git-RM roredu. c
Merge:
Switch to master, and then select merge
How to clone a version Library
CD/slview
Git clone root @ localhost:/slview/Git-repos Git-workhome
Error:
Bash: Git-upload-Pack: Command not found
Fatal: the remote end hung up unexpectedly
Answer:
[Root @ localhost Code] # ln-S/usr/local/git/bin/Git-upload-pack/usr/bin/Git-upload-pack
Error:
Remote: Error: refusing to update checked out branch: refs/heads/Master
Remote: Error: by default, updating the current branch in a non-bare Repository
Remote: Error: is denied, because it will make the index and work tree inconsistent
Remote: Error: With what you pushed, and will require 'git reset -- hard' to match
Solution:
Use git -- bare init to create a database