服务器端git配置:
[root@ImmenseGargantuan-VM home]# yum install git -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repos-lax.psychz.net
* epel: mirror.hmc.edu
* extras: mirror.hostduplex.com
* updates: mirrors.ocf.berkeley.edu
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-6.el7_2.1 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-6.el7_2.1 for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Running transaction check
---> Package perl-Git.noarch 0:1.8.3.1-6.el7_2.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
git x86_64 1.8.3.1-6.el7_2.1 base 4.4 M
Installing for dependencies:
perl-Git noarch 1.8.3.1-6.el7_2.1 base 53 k
Transaction Summary
=============================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 4.4 M
Installed size: 22 M
Downloading packages:
(1/2): perl-Git-1.8.3.1-6.el7_2.1.noarch.rpm | 53 kB 00:00:00
(2/2): git-1.8.3.1-6.el7_2.1.x86_64.rpm | 4.4 MB 00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.7 MB/s | 4.4 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : git-1.8.3.1-6.el7_2.1.x86_64 1/2
Installing : perl-Git-1.8.3.1-6.el7_2.1.noarch 2/2
Verifying : perl-Git-1.8.3.1-6.el7_2.1.noarch 1/2
Verifying : git-1.8.3.1-6.el7_2.1.x86_64 2/2
Installed:
git.x86_64 0:1.8.3.1-6.el7_2.1
Dependency Installed:
perl-Git.noarch 0:1.8.3.1-6.el7_2.1
Complete!
[root@ImmenseGargantuan-VM home]# mkdir git
[root@ImmenseGargantuan-VM home]# cd git/
[root@ImmenseGargantuan-VM git]# mkdir qead.git
[root@ImmenseGargantuan-VM git]# cd qead.git/
[root@ImmenseGargantuan-VM qead.git]# git init --bare
Initialized empty Git repository in /home/git/qead.git/
[root@ImmenseGargantuan-VM qead.git]# cp hooks/post-update.sample hooks/post-update
[root@ImmenseGargantuan-VM qead.git]# vi hooks/post-update
[root@ImmenseGargantuan-VM qead.git]# cat hooks/post-update
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
//添加此行:work-tree你的网站目录,git-dir你的git版本控制器目录,意义利用git hooks(钩子)实现实时更新网站文件,~~也有人说使用post-receive钩子(无效)~~
git --work-tree=/home/qead --git-dir=/home/git/qead.git/ checkout -f
exec git update-server-info
本地端设置:netbeans为例
1、新建项目并初始化git仓库
2、首次提交到本地仓库,因为在服务器端建立的是空的仓库
3、远程推入到服务器端git仓库,配置远程git仓库的信息
4、在netbeans新建test文件,先提交本地,在远程推入
还没有任何评论,你来说两句吧