Linux installation Git service

[root@testgit rpmlib]# pwd
/opt/rpmlib
[root@testgit rpmlib]# ls
asciidoc-8.6.9-1.el6.rfx.noarch.rpm   gettext-devel-0.17-16.el6.x86_64.rpm
autoconf-2.63-5.1.el6.noarch.rpm      libiconv-1.14.tar.gz
curl-devel-7.13.1-3.x86_64.rpm        openssl-devel-1.0.1e-42.el6.x86_64.rpm
docbook2X-0.8.8-2.1.x86_64.rpm        xmlto-0.0.18-4.x86_64.rpm
expat-devel-2.0.1-9.1.el6.x86_64.rpm  zlib-devel-1.2.3-29.el6.x86_64.rpm
[root@testgit rpmlib]# rpm -q curl-devel
[root@testgit rpmlib]# rpm -ivh curl-devel-7.13.1-3.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q expat-devel
[root@testgit rpmlib]# rpm -ivh expat-devel-2.0.1-9.1.el6.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q gettext-devel
[root@testgit rpmlib]# rpm -ivh gettext-devel-0.17-16.el6.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q openssl-devel
[root@testgit rpmlib]# rpm -ivh openssl-devel-1.0.1e-42.el6.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q zlib-devel
[root@testgit rpmlib]# rpm -ivh zlib-devel-1.2.3-29.el6.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q perl-devel
perl-devel-5.10.1-119.el6_1.1.x86_64

[root@testgit rpmlib]# rpm -q asciidoc
[root@testgit rpmlib]# rpm -ivh asciidoc-8.6.9-1.el6.rfx.noarch.rpm --nodeps
[root@testgit rpmlib]# rpm -q autoconf
[root@testgit rpmlib]# rpm -ivh autoconf-2.63-5.1.el6.noarch.rpm --nodeps
[root@testgit rpmlib]# rpm -q docbook2X
[root@testgit rpmlib]# rpm -ivh docbook2X-0.8.8-2.1.x86_64.rpm --nodeps
[root@testgit rpmlib]# rpm -q xmlto
[root@testgit rpmlib]# rpm -ivh xmlto-0.0.18-4.x86_64.rpm --nodeps


If there is no gcc-related compiler, the source code cannot be installed. The following are the gcc and other related rpm packages that need to be installed on CentOS6:
cloog-ppl-0.15 .7-1.2.el6.x86_64.rpm
cpp-4.4.6-4.el6.x86_64.rpm
gcc-4.4.7-16.el6.x86_64.rpm
gcc-c++-4.4.7-16.el6.x86_64. rpm
glibc-devel-2.12-1.166.el6.x86_64.rpm
glibc-headers-2.12-1.80.el6.x86_64.rpm
kernel-headers-2.6.32-279.el6.x86_64.rpm
libstdc++-devel-4.4.6- 4.el6.x86_64.rpm
mpfr-2.4.1-6.el6.x86_64.rpm
ppl-0.10.2-11.el6.x86_64.rpm



[root@testgit opt]# tar -zxvf git-2.7.0.tar.gz
[root@testgit opt]# cd git-2.7.0
[root@testgit git-2.7.0]# autoconf
[root@testgit git- 2.7.0]# ./configure --prefix=/usr/local
[root@testgit git-2.7.0]# make
[root@testgit git-2.7.0]# make install
[root@testgit git-2.7.0 ]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib -- this line is added later, without this line when entering git --version An error will be reported
[root@testgit git-2.7.0]# /sbin/ldconfig
[root@testgit git-2.7.0]# git --version
git version 2.7.0



------------- -------------------------------------------------- -------------------



The following is the basic operation of Git:

RPM package download address: http://rpm.pbone.net/index.php3/stat/21/year/ 2005/month/05/day/03
http://pkgs.org/download/
http://rpmfind.net/linux/rpm2html/search.php

If you want to install Git from source, you need to install the libraries that Git depends on: curl, zlib, openssl, expat, and libiconv. If you have yum (such as Fedora) or apt-get (such as Debian-based systems) on your system, you can use one of the following commands to install the minimal dependencies to compile and install the binary version of Git:

  $ sudo yum install curl -devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
  $ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
In order to be able to add more formats of documentation (such as doc, html, info), you need to install the following dependencies:

  $ sudo yum install asciidoc xmlto docbook2x
  $ sudo apt-get install asciidoc xmlto docbook2x
Once you have installed all the necessary dependencies, you can proceed to get the latest release tarball from several places. You can get it from the Kernel.org website at https://www.kernel.org/pub/software/scm/git, or from a mirror on the GitHub website at https://github.com/git /git/releases. Usually the latest version is on GitHub, but kernel.org contains file download signatures, which you can use if you want to verify the correctness of the download.

rpm -q gcc gcc-c++ glibc glibc-common glibc-devel
rpm -q libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
rpm -ivh gettext-devel-0.17-16.el6.x86_64.rpm --nodeps
rpm -ivh libiconv- 1.14-3.el6.x86_64.rpm --nodeps

tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local (or #./configure --prefix=/usr/local/libiconv)
make
make install


Next, compile and install:

  $ tar -zxf git-2.7.0.tar.gz
  $ cd git-2.7.0
  $ make configure
  $ ./configure --prefix=/usr
  $ make all doc info
  $ sudo make install install-doc install-html install-info Once
done, you can use Git to get Git upgrades :

  $ git clone git://git.kernel.org/pub/scm/git/git.git



Red Hat Enterprise Linux 6.4 source code Install Git server steps as follows:
rpm -q curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel
tar -zxf git-2.7.0.tar.gz
cd git-2.7.0
autoconf
./configure or ./configure --prefix=/usr/local or ./configure --prefix=/usr/local/git/
make
make install
[root@testagent lib]# pwd
/usr/local/lib
[root@ testagent lib]# ls
charset.alias libcharset.so libiconv.la libiconv.so.2.5.1
libcharset.a libcharset.so.1 libiconv.so preloadable_libiconv.so
libcharset.la libcharset.so.1.0.0 libiconv.so.2
[root@testagent /]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib -- this line is added later, without this line, enter git --version will report an error

[root@testagent /]# /sbin/ldconfig
[root@testagent git-2.7.0]# git --version
git version 2.7.0
[root@testagent git-2.7.0]# cd /usr/local/bin
[root@testagent bin]# pwd
/usr/local/bin
[root@testagent bin]# ls
git gitk git-shell git-upload-pack
git-cvsserver git-receive-pack git-upload-archive iconv


can serve Git Add to the environment variable:
[root@testagent /]# vi /etc/profile
export GIT_HOME=/usr/local/git/
export PATH=$PATH:$GIT_HOME/bin The


steps to create a Git repository are as follows:
[root@testagent git- 2.7.0]# cd /
[root@testagent /]# useradd git
[root@testagent /]# passwd git
Changing password for user git.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@testagent /]# su - git
[git@testagent ~]$ ls
[git@testagent ~]$ mkdir mygitproject
[git@testagent ~]$ ls
mygitproject
[git@testagent ~] $ cd mygitproject/
[git@testagent mygitproject]$ ls
[git@testagent mygitproject]$ git --bare init
Initialized empty Git repository in /home/git/mygitproject/
[git@testagent mygitproject]$ ls
branches config description HEAD hooks info objects refs
[git@testagent mygitproject]$

https://git-for-windows.github.io/ Download mysysgit
http://tortoisegit.org/download/ To download TortoiseGit ,

first clone a .git folder to a local Windows machine

http://bbs.csdn.net/topics/390902529/
origin
[email protected]:mygitproject
http://blog.csdn.net/forever_wind/article/details/37506389
http://www.cnblogs.com/wang_yb /p/3867221.html



Since git rejects the push operation by default, it needs to be set. Modify .git/config and add the following code:
[receive]
denyCurrentBranch = ignore


[git@testagent mygitproject]$ pwd
/home/git/mygitproject
branches config description HEAD hooks info objects refs
[git@testagent mygitproject]$ vi config
[core]
        repositoryformatversion=0
        filemode=true
        bare=true
[receive]
denyCurrentBranch=ignore
[git@testagent mygitproject]$ cat config


[git@testagent ~]$ pwd
/home/git
[git@testagent ~]$ git clone mygitproject git1
[git@testagent ~]$ git clone mygitproject git2
Currently the git branch is empty. We commit something to create the master branch.
[git@testagent ~]$ cd git1
[git@testagent git1]$ pwd
/home/git/git1
[git@testagent git1]$ touch a.txt
[git@testagent git1]$ git add .
[git@testagent git1] $ git commit -m "init"
[git@testagent git1]$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 199 bytes | 0 bytes/s, done.
Total 3 ( delta 0), reused 0 (delta 0)
To /home/git/mygitproject/
* [new branch] master -> master
[git@testagent git1]$ git branch -a
* master
  remotes/origin/master


[git@testagent git2]$ pwd
/home/git/git2
[git@testagent git2]$ git pull origin
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /home/git/mygitproject
* [new branch]      master     -> origin/master
[git@testagent git2]$ ls
a.txt

[git@testagent heads]$ pwd
/home/git/mygitproject/refs/heads
[git@testagent heads]$ ls
master

[git@testagent git1]$ git commit -am "a.txt add : git1 user add nihao"
[master 4356801] a.txt add : git1 user add nihao
1 file changed, 2 insertions(+), 1 deletion(-)

Command format for submitting a local branch to a remote branch: git push origin Local branch: remote branch
[git@testagent git1]$ git push origin master:master
Counting objects: 3 , done.
Writing objects: 100% (3/3), 277 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /home/git/server
   9e4111e..4356801 master - >

After modifying a file on the master Windows host, you must do two steps in TortoiseGit to submit it to the remote warehouse: the
first step: Git submission (C)-> "master"... --This step is to submit to the local Warehouse, equivalent to git commit -am "description message"
Step 2: Push... --This step is to submit to the remote warehouse, equivalent to git push origin master:master

[Note]: Git is different from Svn, Git must first Submit to the local repository and then submit to the remote repository.

The command format for pulling files from a remote repository to a local: git pull origin master:master
[git@testagent git1]$ git pull origin master:master
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /home/git/server
   4356801..a69dceb  master     -> master
   4356801..a69dceb  master     -> origin/master
warning: fetch updated the current branch head.
fast-forwarding your working tree from
commit 4356801baf0cc3d83e29145384374cb4b6e30360.
Already up-to-date.
[git@testagent git1]$

删除仓库文件命令如下:
git add -u
git commit -m "delete test"
git push


Git服务器权限管理工具:
gitlab gitolite gitosis

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326686884&siteId=291194637