phabricator通过http推送和拉取代码

1,137 阅读3分钟

一、服务端配置:

检查nginx用户

[root@59et mnt]# ps -ef|grep nginxwww      12734 29854  0 Mar10 ?        00:01:16 nginx: worker processwww      12735 29854  0 Mar10 ?        00:01:20 nginx: worker processwww      12736 29854  0 Mar10 ?        00:01:09 nginx: worker processwww      12737 29854  0 Mar10 ?        00:01:15 nginx: worker processwww      12738 29854  0 Mar10 ?        00:01:16 nginx: worker processwww      12739 29854  0 Mar10 ?        00:01:22 nginx: worker processwww      12740 29854  0 Mar10 ?        00:01:17 nginx: worker processwww      12741 29854  0 Mar10 ?        00:01:21 nginx: worker processwww      12742 29854  0 Mar10 ?        00:00:00 nginx: cache manager processroot     29854     1  0  2019 ?        00:00:00 nginx: master process /opt/nginx/sbin/nginx

检查php用户

[root@59et mnt]# ps -ef|grep phproot     21288     1  0 Mar11 ?        00:00:02 php-fpm: master process (/etc/php-fpm.conf)apache   21289 21288  0 Mar11 ?        00:06:56 php-fpm: pool wwwapache   21290 21288  0 Mar11 ?        00:07:01 php-fpm: pool wwwapache   21291 21288  0 Mar11 ?        00:07:01 php-fpm: pool wwwapache   21292 21288  0 Mar11 ?        00:07:15 php-fpm: pool wwwapache   21293 21288  0 Mar11 ?        00:06:58 php-fpm: pool wwwapache   21295 21288  0 Mar11 ?        00:06:57 php-fpm: pool wwwapache   21308 21288  0 Mar11 ?        00:06:55 php-fpm: pool wwwapache   21400 21288  0 Mar11 ?        00:07:03 php-fpm: pool wwwapache   21421 21288  0 Mar11 ?        00:07:02 php-fpm: p

检查phd用户

[root@59et mnt]# ps -ef|grep phdphd      26182     1  0 09:26 ?        00:00:04 php ./phd-daemonphd      26185 26182  0 09:26 ?        00:00:00 php /alidata2/phabricator/phabricator/scripts/daemon/exec/exec_daemon.php PhabricatorFactDaemonroot     28077 26077  0 10:41 pts/0    00:00:00 grep phd[root@59et mnt]# 

赋予权限

#includedir /etc/sudoersgit ALL=(ALL)       NOPASSWD: ALLgit ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-packwww ALL=(phd) SETENV: NOPASSWD: /usr/local/libexec/git-core/git-http-backendapache ALL=(phd) SETENV: NOPASSWD: /usr/local/libexec/git-core/git-http-backend

Phabricator开通支持http功能

首先,请确认Phabricator的配置项 diffusion.allow-http-auth 设置为 true。可以在 左侧菜单面板 All Setttings 中查找 diffusion.allow-http-auth ,点击之后可设置,请设置为 Allow HTTP Basic Auth。然后,所有用户需要使用 HTTP 访问仓库之前,需要设置自己的密码:点击你的头像 ---> 左侧菜单面板 Manage ---> 右侧菜单面板 Edit Settings ---> 左侧菜单面板 VCS Password, 一般来说,不需要其它配置就可以使用 HTTP 了 。VCS密码会对密码难易度做校验,建议8位以上大写字母+小写字母+数字

二、客户端测试:

提交代码:

11:37:27.922: [JWordpress] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain pha refs/heads/master:master --follow-tagsTo http://phabricator.59et.com/diffusion/1/jwordpress.git=    refs/heads/master:refs/heads/master [up to date]Done

下载代码

11:35:49.701: [JWordpress] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain pha refs/heads/master:master --follow-tagsTo http://phabricator.59et.com/diffusion/1/jwordpress.git=    refs/heads/master:refs/heads/master [up to date]Done

打完 收工,享受过程

三、常见问题

问题1描述:

git push到远程分支时报错 11:15:13.627: [JWordpress] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain pha refs/heads/master:master --follow-tags Delta compression using up to 8 threads. error: RPC failed; HTTP 411 curl 22 The requested URL returned error: 411 Length Required fatal: The remote end hung up unexpectedly Total 908 (delta 466), reused 774 (delta 392) fatal: The remote end hung up unexpectedly

解决方案:

客户端设置 git POST 缓冲区过小. git config http.postBuffer 524288000