1.服务器上安装git,过程不描述;
- 在某个目录下创建一个git仓库,执行
git init --bare test.git
; - 这样就OK了,然后客户端拉取代码,不能拉取代码,多数是权限的问题,设置git组后分配目录的操作权限;
- 第一次push错误,insufficient permission for adding an object to repository database,权限问题,参考push error,配置仓库为共享库,git config core.sharedRepository
if is not group or true or 1 or some mask, try running:
git config core.sharedRepository group,再分配权限,
cd /path/to/test.git
chgrp -R groupname .
chmod -R g+rwX .
find . -type d -exec chmod g+s ‘{}’ +
第一次push不上分支问题,git config ‘receive.denyCurrentBranch’ warn 配置下这个就OK;
push 文件看不见问题,客服端push,服务端马上删除,remote: warning: updating the current branch,目录下执行
git reset --hard
,OK;如果是初始化的工作仓库,改为共享仓库,执行
这里写代码片