GIT 服务器自己搭建问题记录

来源:互联网 发布:南传上座部 知乎 编辑:程序博客网 时间:2024/05/16 07:49

1.服务器上安装git,过程不描述;

  1. 在某个目录下创建一个git仓库,执行git init --bare test.git;
  2. 这样就OK了,然后客户端拉取代码,不能拉取代码,多数是权限的问题,设置git组后分配目录的操作权限;
  3. 第一次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 ‘{}’ +

  1. 第一次push不上分支问题,git config ‘receive.denyCurrentBranch’ warn 配置下这个就OK;

  2. push 文件看不见问题,客服端push,服务端马上删除,remote: warning: updating the current branch,目录下执行git reset --hard,OK;

  3. 如果是初始化的工作仓库,改为共享仓库,执行这里写代码片