Git权限问题,但是在哪里?

时间:2018-12-06 11:56:05

标签: git

我用git设置了一个基本的docker容器。由于某种原因,我收到以下错误

remote: error: insufficient permission for adding an object to repository database /git-server/repos/ansible.git/./objects/incoming-JPCnWj
remote: fatal: failed to write object
error: remote unpack failed: unpack-objects abnormal exit
To ssh://nas.:2222/git-server/repos/ansible.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'ssh://git@nas.:2222/git-server/repos/ansible.git'

现在,我在发布之前已经浏览了许多网站,所以这是我的设置。

  1. 在尝试推送到NAS(docker容器)之前,我一直推送到GitHub
  2. 我删除了所有原产地(Github)的引用,并添加了我的NAS。

    $ git remote -v 原始ssh:// git @ nas。:2222 / git-server / repos / ansible.git(提取) 原始ssh:// git @ nas。:2222 / git-server / repos / ansible.git(push)

我已经检查了客户端的权限

$ ls -lFa .git
total 56
drwxrwxr-x.  8 jdoe jdoe 4096 Dec  6 10:19 ./
drwxrwxr-x.  8 jdoe jdoe 4096 Dec  5 10:52 ../
-rw-rw-r--.  1 jdoe jdoe   35 Dec  4 11:47 COMMIT_EDITMSG
-rw-rw-r--.  1 jdoe jdoe   23 Dec  4 11:01 HEAD
drwxrwxr-x.  2 jdoe jdoe 4096 Dec  4 11:00 branches/
-rw-rw-r--.  1 jdoe jdoe  222 Dec  6 10:19 config
-rw-rw-r--.  1 jdoe jdoe   73 Dec  4 11:00 description
drwxrwxr-x.  2 jdoe jdoe 4096 Dec  4 11:00 hooks/
-rw-rw-r--.  1 jdoe jdoe 1703 Dec  4 11:47 index
drwxrwxr-x.  2 jdoe jdoe 4096 Dec  4 11:00 info/
drwxrwxr-x.  3 jdoe jdoe 4096 Dec  4 11:01 logs/
drwxrwxr-x. 75 jdoe jdoe 4096 Dec  4 11:47 objects/
-rw-rw-r--.  1 jdoe jdoe   46 Dec  5 18:41 packed-refs
drwxrwxr-x.  5 jdoe jdoe 4096 Dec  4 11:01 refs/

在服务器(容器)上

$ ls -lFa
total 36
drwxr-xr-x 1 git users 1344 Dec  6 09:16 ./
drwxr-x--- 1 git users  168 Dec  6 09:16 ../
-rw-r--r-- 1 git users   23 Dec  6 09:16 HEAD
drwxr-xr-x 1 git users    0 Dec  6 09:16 branches/
-rw-r--r-- 1 git users   66 Dec  6 09:16 config
-rw-r--r-- 1 git users   73 Dec  6 09:16 description
drwxr-xr-x 1 git users 2000 Dec  6 09:16 hooks/
drwxr-xr-x 1 git users  168 Dec  6 09:16 info/
drwxr-xr-x 1 git users  504 Dec  6 09:29 objects/
drwxr-xr-x 1 git users  336 Dec  6 09:16 refs/

服务器上的用户确实是git

$ id git
uid=1027(git) gid=100(users) groups=100(users)

git uid是1027,因此它与NAS上的用户匹配,并且不会引起权限问题。

我是唯一使用git服务器的人。我尝试使用以下命令(使用ssh键)推送代码

$ git push --mirror ssh://git@nas.:2222/git-server/repos/ansible.git

根据torek的建议,我添加了git跟踪,但没有帮助。据我所知,告诉我我的许可是错误的,这太冗长了吗?!?

$ GIT_TRACE=2 GIT_TRACE_PACK_ACCESS=2 GIT_TRACE_PACKET=2 GIT_TRACE_SETUP=2 git push -v origin master
12:32:30.762269 trace.c:318             setup: git_dir: .git
12:32:30.762371 trace.c:319             setup: git_common_dir: .git
12:32:30.762388 trace.c:320             setup: worktree: /home/jdoe/Developement/ansible/ansible
12:32:30.762398 trace.c:321             setup: cwd: /home/jdoe/Developement/ansible/ansible
12:32:30.762416 trace.c:322             setup: prefix: (null)
12:32:30.762433 git.c:415               trace: built-in: git push -v origin master
Pushing to ssh://git@nas:2222/git-server/repos/ansible.git
12:32:30.763365 run-command.c:643       trace: run_command: unset GIT_PREFIX; ssh -p 2222 git@nas 'git-receive-pack '\''/git-server/repos/ansible.git'\'''
12:32:30.916274 pkt-line.c:80           packet:         push< 0000000000000000000000000000000000000000 capabilities^{}\0report-status delete-refs side-band-64k quiet atomic ofs-delta agent=git/2.11.0
12:32:30.916346 pkt-line.c:80           packet:         push< 0000
12:32:30.916444 pkt-line.c:80           packet:         push> 0000000000000000000000000000000000000000 02be3c652232a8075f1ea6dc49b5e3feb2b80e0b refs/heads/master\0 report-status side-band-64k agent=git/2.19.2
12:32:30.916466 pkt-line.c:80           packet:         push> 0000
12:32:30.916604 run-command.c:643       trace: run_command: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
12:32:30.918739 trace.c:318             setup: git_dir: .git
12:32:30.918784 trace.c:319             setup: git_common_dir: .git
12:32:30.918791 trace.c:320             setup: worktree: /home/jdoe/Developement/ansible/ansible
12:32:30.918796 trace.c:321             setup: cwd: /home/jdoe/Developement/ansible/ansible
12:32:30.918801 trace.c:322             setup: prefix: (null)
12:32:30.918806 git.c:415               trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress
Enumerating objects: 90, done.
Counting objects: 100% (90/90), done.
Delta compression using up to 4 threads
Compressing objects: 100% (83/83), done.
Writing objects: 100% (90/90), 15.87 KiB | 3.17 MiB/s, done.
Total 90 (delta 30), reused 0 (delta 0)
12:32:30.950405 pkt-line.c:80           packet:     sideband< \2error: insufficient permission for adding an object to repository database /git-server/repos/ansible.git/./objects/incoming-
12:32:30.950448 pkt-line.c:80           packet:     sideband< \2LKk1Fxfatal: failed to write object
remote: error: insufficient permission for adding an object to repository database /git-server/repos/ansible.git/./objects/incoming-LKk1Fx
remote: fatal: failed to write object
12:32:30.950474 pkt-line.c:80           packet:     sideband< \10028unpack unpack-objects abnormal exit0028ng refs/heads/master unpacker error0000
12:32:30.950515 pkt-line.c:80           packet:         push< unpack unpack-objects abnormal exit
error: remote unpack failed: unpack-objects abnormal exit
12:32:30.950571 pkt-line.c:80           packet:         push< ng refs/heads/master unpacker error
12:32:30.950584 pkt-line.c:80           packet:         push< 0000
12:32:30.952843 pkt-line.c:80           packet:     sideband< 0000
To ssh://nas:2222/git-server/repos/ansible.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'ssh://git@nas:2222/git-server/repos/ansible.git'

我在做什么错?我想这很容易,但是我已经花了太长时间了。我有远见。 ;)

欢迎任何帮助。

谢谢。 埃德

0 个答案:

没有答案