转载地址:https://blog.csdn.net/qq_31059985/article/details/80606882
服务器 CentOS7 + git version 1.8.3.1 客户端 Windows7 + git version 2.17.1.windows.2
服务器端安装和配置
安装Git服务器端
yum install git
安装完后,查看 Git 版本
[root@iZm5egstry6atum2bewjdgZ ~]# git --version git version 1.8.3.1
创建服务器端git仓库,这里仓库设置为:/usr/local/gitrepository
[root@iZm5egstry6atum2bewjdgZ local]# mkdir -p /usr/local/gitrepository
[root@iZm5egstry6atum2bewjdgZ local]# cd /usr/local/gitrepository
[root@iZm5egstry6atum2bewjdgZ gitrepository]# git init --bare /usr/local/gitrepository
Initialized empty Git repository in /usr/local/gitrepository/
服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码,
[root@iZm5egstry6atum2bewjdgZ gitrepository]# id git id: git: no such user [root@iZm5egstry6atum2bewjdgZ gitrepository]# useradd git [root@iZm5egstry6atum2bewjdgZ gitrepository]# passwd git Changing password for user git. New password: 627woaini BAD PASSWORD: The password contains the user name in some form Retype new password: 627woaini passwd: all authentication tokens updated successfully.
然后把 Git 仓库的所有者修改为 git用户
[root@iZm5egstry6atum2bewjdgZ gitrepository]# cd ..
[root@iZm5egstry6atum2bewjdgZ local]# chown -R git:git gitrepository/
客户端安装和配置
下载 Git for Windows,地址:https://git-for-windows.github.io/
一路next安装完之后,创建一个git本地存放地址,如:Z:\gittest 进入Z:\gittest 右键 Git Bash 打开命令行客户端。
安装完之后,查看 Git 版本