Git repository server configuration;
Two different ways:
Mode one: Using the GIT protocol, create a git repository server, can only download, not upload;
Mode two: the use of HTTP or HTTPS protocol, install httpd1.6.6 above version of support upload and download and other rich features;
This experiment physics machine win7, the virtual machine is two centos7:
Local git repository, node1:172.18.11.111
Remote git repository, noed2:172.18.11.112
Way Figure one: Create a git remote repository using the GIT protocol:
In Node2:
Installing Git-daemon
]# yum-y Install Git-daemon
Initialize a bare repository: name Myproject.git
]# cd/var/lib/git/
]# git init--bare myproject.git
]# ls/var/lib/git/myproject.git/
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/82/EF/wKioL1dmPxOihOLvAAASZbCAxm0256.png "title=" 2.png " alt= "Wkiol1dmpxoiholvaaaszbcaxm0256.png"/>
In Node1:
To clone a remote repository:
]# git clone git://172.18.11.112/myproject.git
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/EF/wKioL1dmPniAcjAfAAAZfVdT02U761.png "title=" 1.png " alt= "Wkiol1dmpniacjafaaazfvdt02u761.png"/>
To view information such as Git view configuration:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/F0/wKiom1dmP7mDwIKmAAA9hLaFlkg557.png "title=" 3.png " alt= "Wkiom1dmp7mdwikmaaa9hlaflkg557.png"/>
The above completes the remote Git repository creation and the local download remote repository, using the GIT protocol, does not support push upload, to implement the push to use the HTTP protocol;
Attention:
The server created by the GIT protocol is defective:
First, push is not supported;
Second, certification is not supported;
Third, the port is very special, tcp/9418
Mode two: Use the HTTP protocol to create a git remote repository:
To implement a Git remote repository based on the HTTP protocol, you can install only one HTTP service.
In Node2:
Installing Git-daemon
]# yum-y Install Git-daemon
]# yum-y Install httpd
For the HTTP protocol git repository, the HTTP protocol must start three modules:
First, the path alias is supported;
Second, environment variable setting;
Thirdly, the CGI mechanism;
Because, based on the HTTP protocol is actually using the poll script to complete the smart settings;
View three modules: Make sure the following three modules are enabled
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/82/EF/wKioL1dmQMGiF8LqAAAPwQgwqC0480.png "title=" 4.png " alt= "Wkiol1dmqmgif8lqaaapwqgwqc0480.png"/>
Create a bare repository directory and authorize:
]# Mkdir/var/www/git
]# Cd/var/www/git
]# git init--bare testproject.git
]# Chown-r Apache:apache/var/www/git
Make sure that the directory belongs to the Apache user, otherwise there will be no write operation permission;
]# vim/etc/httpd/conf/httpd.conf
#DocumentRoot "/var/www/html"
To provide a GIT repository based on the HTTP protocol implementation, create a new configuration file:
]# vim/etc/httpd/conf.d/git.conf
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/EF/wKioL1dmQomylwNnAAC5vjg8gj0818.png "title=" 5.png " alt= "Wkiol1dmqomylwnnaac5vjg8gj0818.png"/>
]# httpd-t
]# systemctl Start Httpd.service
]# SS-TNL View 80 port monitoring;
Go back to the Node1 node and clone the remote Git repository based on the HTTP protocol:
]# git clone http://172.18.11.112/git/testproject.git
]# CD testproject/
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/F0/wKiom1dmQxbja49xAAAwXQj8D6g141.png "title=" 6.png " alt= "Wkiom1dmqxbja49xaaawxqj8d6g141.png"/>
At this point, the repository is downloaded locally, if the content is changed on this remote tracing branch:
]# echo "New Line" > README
]# git add README
]# git commit-m "v0.1"
Commit and upload to the remote server:
]# git push Origin master
Enter your authorized username and password to complete the upload:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/F0/wKiom1dmQ_aC_6V6AAAnB2807S8374.png "title=" 7.png " alt= "Wkiom1dmq_ac_6v6aaanb2807s8374.png"/>
The above is the entire process of creating a git remote repository based on the HTTP protocol, of course, the configuration of the HTTP protocol warehouse, and then configure the HTTPS protocol Git repository, nothing more than a step to configure the CA certificate, and so on;
Authentication using this method is very insecure and can be done Htsps protocol;
Put the account password in the file, is not very appropriate, on the Internet in the public warehouse, but also based on the MySQL authentication, the account number, password in the MySQL database table;
These self-management are very troublesome, there has been the internet dedicated to do code hosting service site.
Create a remote git repository