centos上部署git

安装Git

1 #安装依赖环境
2 [root@wys01 wys]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
3 #直接安装
4 [root@wys01 wys]# yum install git
5 
6 #查看版本
7 [root@wys01 wys]# git --version

创建git用户

1 [root@wys ~]# useradd git #给git用户添加密码
2 
3 [root@wys git]# echo 123|passwd --stdin git

创建公匙文件

1 [root@wys ~]# cd /home/git/
2 [root@wys git]# mkdir .ssh
3 [root@wys git]# chmod 700 .ssh
4 [root@wys git]# touch .ssh/authorized_keys
5 [root@wys git]# chmod 600 .ssh/authorized_keys

初始化仓库

1 [root@wys ~]# mkdir -p /gitceshi/myproject.git
2 [root@wys ~]# chown -R git:git /gitceshi/
3 [root@wys ~]# cd mypython/
4 [root@wys ~]# git init --bare /gitceshi/myproject.git
5 [root@wys ~]# chown -R git:git /gitceshi/myproject.git

Windows端使用Git

下载安装Git。

打开Git Bash

生成SSH公钥秘钥对

1 #后面的邮箱写自己的
2 $ ssh-keygen -t rsa -C "examaple@email.com"

过程中直接回车即可

密匙文件一般在C:\Users\Administrator.ssh下,把公钥文件idrsa.pub的内容拷贝到服务器端/home/git/.ssh/authorizedkeys这个文件中,ok,至此可以开始访问服务器上的Git项目了。

克隆项目

1 $ cd dir(项目路径)
2 $ git clone git@10.0.0.103:/gitceshi/myproject.git

把本地项目与服务器项目进行关联

1 $ cd dir(项目路径)
2 $ git remote add origin git@10.0.0.103:/gitceshi/myproject.git

git文件太大上传不了解决办法,在git-shell里

1 #修改单文件最大上传为500MB
2 git config --global http.postBuffer 524288000 

 

posted @ 2017-08-27 10:24  ForeverPine  阅读(192)  评论(0编辑  收藏  举报
TOP