如何让phabricator到观察者本地git存储库

时间:2018-05-18 12:59:29

标签: git phabricator

我在尝试观察phabricator中的本地git存储库时遇到错误。回购在运行phabricator的同一台机器上,我相信拥有所有正确的权限,但是phab无法识别路径。有没有其他人遇到过类似的问题?你怎么解决的?提前感谢您的任何指导。

主要错误:

phabricator-ssh-exec: Unrecognized repository path "/var/repos/git/test". Expected a path like "/diffusion/X/", "/diffusion/123/", or "/source/thaumaturgy".

我设置观察存储库的步骤:

Created a new repository in phabricator

Set the following (all) default URIs to "read only"
    ssh://git@phabricator.localhost.com:2222/diffusion/1/test Read Only Hidden
    ssh://git@phabricator.localhost.com:2222/source/test  Read Only Visible
    ssh://git@phabricator.localhost.com:2222/diffusion/TEST/test  Read Only Hidden

Created a 4th URI and set it to observe:
    ssh://git@phabricator.localhost.com:2222/var/repos/git/test Observe Hidden 

Set up credentials for that URI successfully

Activated respository

完整的phabricator错误:

Raw Error
Error updating working copy: Command failed with error #128!
COMMAND
git ls-remote '********'

STDOUT
( empty)

STDERR
Warning: Permanently added '[phabricator.localhost.com]:2222' (ECDSA) to the list of known hosts.
phabricator-ssh-exec: Unrecognized repository path "/var/repos/git/test". Expected a path like "/diffusion/X/", "/diffusion/123/", or "/source/thaumaturgy".
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

简短摘要:

我也试过使用test.git。目录/ var / repos / git / test存在并且是wdev组的775(读,写,执行),其中myuser和git是成员

我无法弄清楚phabricator在哪里寻找这些目录。我期望从我的服务器的根目录,但/ diffusion / X最无耻的不是我的服务器root。我做错了假设吗?

我尝试了3个其他URI,所有这些URI都出现了同样的错误。我在下面提供了更多信息。

TL;博士

导致相同错误的其他步骤:

1.  Changed URI to ssh://git@phabricator.localhost.com:2222/var/repos/git/test.git
2.  Changed URI to ssh://git@phabricator.localhost.com:2222/home/myuser/local-repos/git/test.git
3.  Changed URI to ssh://git@phabricator.localhost.com:2222/home/myuser/local-repos/git/test

我的phabricator SSH用户:

[myuser@localhost ~]$ cat /etc/passwd |grep git
git:x:1002:1003::/var/repos/git:/bin/bash

[myuser@localhost ~]$ cat /etc/group |grep wdev
wdev:x:1001:myuser,apache,phd,git

[myuser@localhost ~]$ sudo cat /etc/shadow |grep git
git:NP:17669:0:99999:7:::

[myuser@localhost ~]$ sudo cat /etc/sudoers.d/phabricator-sudoers
git All=(phd) SETENV: NOPASSWD: /usr/bin/ls, /usr/bin/git, /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /usr/bin/ssh
apache All=(phd) SETENV: NOPASSWD: /usr/bin/git, /usr/bin/git-http-backend
myuser All=(phd) SETENV: NOPASSWD: /var/www/phabricator/phabricator/bin/phd

Phabricator SSH用户可以ssh:

[myuser@localhost ~]$ echo {} | ssh -p 2222  git@phabricator.localhost.com conduit conduit.ping
{"result":"localhost.localdomain","error_code":null,"error_info":null}

测试存储库路径的权限

[myuser@localhost apache2-php7-postgres]$ cd /var

[myuser@localhost var]$ ls -ltrh |grep repos
drwxrwxr-x.  3 myuser wdev   4.0K May  2 16:21 repos

[myuser@localhost var]$ cd repos

[myuser@localhost repos]$ ls -ltrh |grep git
drwxrwxr-x. 4 myuser wdev 4.0K May 18 08:00 git

[myuser@localhost repos]$ cd git

[myuser@localhost git]$ ls -ltrh
total 4.0K
drwxrwxr-x. 7 myuser wdev 4.0K May  2 16:47 test

[myuser@localhost git]$ cd test

[myuser@localhost test]$ ls -alrh
total 40K
drwxrwxr-x. 4 myuser wdev 4.0K May  2 16:47 refs
drwxrwxr-x. 7 myuser wdev 4.0K May  2 16:47 objects
drwxrwxr-x. 2 myuser wdev 4.0K May  2 16:47 info
drwxrwxr-x. 2 myuser wdev 4.0K May  2 16:47 hooks
-rw-rw-r--. 1 myuser wdev   23 May  2 16:47 HEAD
-rw-rw-r--. 1 myuser wdev   73 May  2 16:47 description
-rw-rw-r--. 1 myuser wdev   66 May  2 16:47 config
drwxrwxr-x. 2 myuser wdev 4.0K May  2 16:47 branches
drwxrwxr-x. 4 myuser wdev 4.0K May 18 08:00 ..
drwxrwxr-x. 7 myuser wdev 4.0K May  2 16:47 .

[myuser@localhost test]$ pwd
/var/repos/git/test

然后我通过运行

来克隆测试存储库
cd /home/myuser/local-repos/git/
git clone /var/repos/git/test

我更改了URI以使用/ home / myuser / local-repos / git / test

克隆的目录权限和内容

[myuser@localhost home]$ ls -ltrh |grep myuser
drwx------. 25 myuser myuser 4.0K May 18 08:10 myuser

[myuser@localhost home]$ cd myuser/

[myuser@localhost ~]$ ls -ltrh |grep local-repos
drwxrwxr-x. 3 myuser wdev     4.0K May  2 16:13 local-repos

[myuser@localhost ~]$ cd local-repos/

[myuser@localhost local-repos]$ ls -altrh
total 12K
drwxrwxr-x.  3 myuser wdev     4.0K May  2 16:13 .
drwxrwxr-x.  3 myuser wdev     4.0K May 18 08:00 git
drwx------. 25 myuser myuser 4.0K May 18 08:10 ..

[myuser@localhost local-repos]$ cd git

[myuser@localhost git]$ ls -altrh
total 12K
drwxrwxr-x. 3 myuser wdev 4.0K May  2 16:13 ..
drwxrwxr-x. 3 myuser wdev 4.0K May  2 16:47 test
drwxrwxr-x. 3 myuser wdev 4.0K May 18 08:00 .

[myuser@localhost git]$ cd test

[myuser@localhost test]$ ls -altrh
total 16K
-rw-rw-r--. 1 myuser wdev    3 May  2 16:47 init.txt
drwxrwxr-x. 3 myuser wdev 4.0K May  2 16:47 .
drwxrwxr-x. 8 myuser wdev 4.0K May  2 16:47 .git
drwxrwxr-x. 3 myuser wdev 4.0K May 18 08:00 ..

2 个答案:

答案 0 :(得分:0)

尝试删除第4个网址(您的),并将ssh://git@phabricator.localhost.com:2222/source/test更改为观察模式。该错误是由于URL不应指向目录(在文件系统中)本身,而是指向Phabricator创建的指向它的URL。

答案 1 :(得分:0)

让它适用于我的设置。

我正在使用我的phabricator ssh用户(git)来获取这个新的ssh URI,结果发现用户无法观察到本地文件系统上已经存在的repo。我更改了URI以在端口22上使用常规ssh(不是在端口2222上运行的phabricator&#s; ssh)并以我的用户ssh进入:

ssh://myuser@phabricator.localhost.com/var/repos/git/test Observe Hidden 

所以现在我为这个预先存在的本地仓库配置了以下URI:

ssh://myuser@phabricator.localhost.com/var/repos/git/test Observe Hidden 
ssh://git@phabricator.localhost.com:2222/diffusion/1/test Read Only Hidden
ssh://git@phabricator.localhost.com:2222/source/test  Read Only Visible
ssh://git@phabricator.localhost.com:2222/diffusion/TEST/test  Read Only Hidden

Phab正在观察我的存储库!

我不知道这是否是标准的,但对我而言,就目前而言,这是有效的。如果有人有其他建议或想法,我很乐意听到。