GVKun编程网logo

git push to nginx + git-http-backend:error:无法访问URL http返回码22致命:git-http-push失败

39

此处将为大家介绍关于gitpushtonginx+git-http-backend:error:无法访问URLhttp返回码22致命:git-http-push失败的详细内容,此外,我们还将为您介绍关

此处将为大家介绍关于git push to nginx + git-http-backend:error:无法访问URL http返回码22致命:git-http-push失败的详细内容,此外,我们还将为您介绍关于Centos 7 Git+httpd 基于密码认证push、docker push 报错Get https://10.100.9.97:5000/v1/_ping: http: server gave HTTP response to HTTPS client、git http push 报错求解、git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案的有用信息。

本文目录一览:

git push to nginx + git-http-backend:error:无法访问URL http返回码22致命:git-http-push失败

git push to nginx + git-http-backend:error:无法访问URL http返回码22致命:git-http-push失败

我在Ubuntu 14.04(使用Nginx / 1.4.6 + git -http-backend + fastcgi:fcgiwrap 1.1.0-2)configuration我的git repos来通过http服务。 但遇到以下错误。

# git push origin master Username for 'http://server.com': git Password for 'http://git@gittest.cloudthis.com': error: Cannot access URL http://server.com/rahul.git/,return code 22 fatal: git-http-push Failed

我的Nginx网站的configuration如下。

server { listen 80; server_name server.com; root /var/www/git/repos; include /etc/Nginx/fcgiwrap.conf; # Added as a support for cgi auth_basic "Welcome to my GIT repos"; # Added for Basic Auth +1 auth_basic_user_file /etc/apache2/.htpasswd; location ~ /git(/.*) { # location /repos/ { #client_max_body_size 0; include /etc/Nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; fastcgi_param GIT_HTTP_EXPORT_ALL true; fastcgi_param GIT_PROJECT_ROOT /var/www/git/repos; fastcgi_param PATH_INFO $uri; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REMOTE_USER $remote_user; fastcgi_pass unix:/var/run/fcgiwrap.socket; } }

我的回购根目录为/var/www/git/repos 。 其中我已经初始化我的裸仓库,如/var/www/git/repos/firstrepo.git/使用命令git --bare init firstrepo.git

Git克隆工作正常,但是当我做出改变,并做git push origin master它给出了错误

Nginx / PHP下载而不是执行

Apache或Nginx来服务Django应用程序?

Nginx + fastcgimultithreading

在Nginx中使用FastCGI封装器执行Perl时,我确实获得了速度优势吗?

mod_fcgid:multithreadingFastCGI现在还是在计划的将来?

# touch newfile # git add newfile # git commit -m " commited " [master 059714a] commited 1 file changed,0 insertions(+),0 deletions(-) create mode 100644 newfile # git push origin master Username for 'http://server.com': git Password for 'http://git@server.com': error: Cannot access URL http://server.com/rahul.git/,return code 22 fatal: git-http-push Failed

任何人有任何想法我做错了什么。 也尝试编辑.git / config文件,如上所述

,但没有帮助。 错误保持不变

在我的access.log

114.143.99.83 - - [14/Aug/2014:15:49:33 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 401 203 "-" "git/1.9.1" 114.143.99.83 - - [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 401 203 "-" "git/1.9.1" 114.143.99.83 - git [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 200 59 "-" "git/1.9.1" 114.143.99.83 - git [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/HEAD HTTP/1.1" 200 23 "-" "git/1.9.1" 114.143.99.83 - - [14/Aug/2014:15:49:37 +0000] "PROPFIND /rahul.git/ HTTP/1.1" 401 203 "-" "git/1.9.1"

在我的error.log

2014/08/14 15:49:33 [error] 2872#0: *19 no user/password was provided for basic authentication,client: 114.143.99.83,server: server.com,request: "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1",host: "server.com" 2014/08/14 15:49:36 [error] 2872#0: *20 no user/password was provided for basic authentication,host: "server.com" 2014/08/14 15:49:37 [error] 2872#0: *21 no user/password was provided for basic authentication,request: "PROPFIND /rahul.git/ HTTP/1.1",host: "server.com"

Nginx错误readv()和recv()失败

Magento的Nginx + PHP-FPM + FastCGIcachingconfiguration

在使用django + Nginx + flup时,打印语句写到哪里?

在Apache中调用PHP-FPM中设置正确的REMOTE_ADDR

Nginx的网关超时后60秒

如receivepack 所述,您可以通过启用receivepack选项来解决身份验证问题,但会禁用身份验证的要求 。 你想要的是与git-http-backend进行通信,哪个用户被成功认证。 这可以通过将REMOTE_USER FastCGI参数设置为$ remote_user Nginx变量来完成 。

server { ... location ... { auth_basic "Restricted"; auth_basic_user_file /path/to/.htpasswd; fastcgi_param REMOTE_USER $remote_user; ... } }

考虑到你当前的Nginx配置,你可能会遇到一个问题,那就是与fcgiwrap的连接过早关闭,这与FastCGI参数的顺序有关系 。 如果/etc/Nginx/fastcgi_params包含SCRIPT_FILENAME的定义,那么在使用fcgiwrap时,它不会被/usr/lib/git-core/git-http-backend覆盖。

我有类似的设置,你有。

我认为问题是关联的接收包选项。

您应该将此选项添加到裸仓库的配置文件中

[http] receivepack = true

或者对于系统范围的设置(如我所做的那样),在/ etc / gitconfig中插入上面的行

您也可以像这样使用config命令来启用存储库:

git config –local http.receivepack true

或者全系统地做:

git config –system http.receivepack true

与Nginx相关的,你也可以在一个位置块中使用身份验证,而不是服务器,这使得配置更加干净(IMO)。

Centos 7 Git+httpd 基于密码认证push

Centos 7 Git+httpd 基于密码认证push



环境:CentOS 7 *2 192.168.11.{29,30}

Git 版本1.8.3

Httpd 版本2.4.5


1、服务端centos7_30配置

[root@CentOS7_30~]#getenforce#查看selinux
Enforcing
[root@CentOS7_30~]#setenforce0#设定为0宽容模式
[root@CentOS7_30~]#vim/etc/selinux/config#修改配置文件,改为disabled
[root@CentOS7_30~]#iptables-F#清楚防火墙配置
[root@CentOS7_30~]#yuminstallgit-daemon-y#安装git-daemon守护进程
[root@CentOS7_30~]#git--version#查看版本
gitversion1.8.3.1
[root@CentOS7_30~]#rpm-qlgit-daemon#查看安装信息
/usr/lib/systemd/system/git.socket
/usr/lib/systemd/system/git@.service
/usr/libexec/git-core/git-daemon
...
[root@CentOS7_30~]#cat/usr/lib/systemd/system/git@.service#查看仓库的定义,--base-path为仓库,也可以修改它自定义指定仓库
[Unit]
Description=GitRepositoriesServerDaemon
Documentation=man:git-daemon(1)

[Service]
User=nobody
ExecStart=-/usr/libexec/git-core/git-daemon--base-path=/var/lib/git--export-all--user-path=public_git--syslog--inetd--verbose
StandardInput=socket
[root@CentOS7_30git]#gitinit--bareproject.git#创建裸仓库
InitializedemptyGitrepositoryin/var/lib/git/project.git/
[root@CentOS7_30git]#ll#查看是否创建成功
total4
drwxr-xr-x.7rootroot4096Oct1121:24project.git
[root@CentOS7_30git]#systemctlstartgit.socket#启动git-daemon
[root@CentOS7_30git]#ss-tnl|grep9418#查看是否启动成功
LISTEN0128:::9418:::*

2、centos7_29客户端clone

[root@CentOS7_29~]#yuminstallgit-y#安装git
[root@CentOS7_29~]#git--version#查看版本,centos6.x都是1.7.1,使用http密码验证会有问题
gitversion1.8.3.1
[root@CentOS7_29~]#gitclonegit://192.168.11.30/project.git#clone
cloninginto'project'...
warning:Youappeartohaveclonedanemptyrepository.
[root@CentOS7_29~]#ls#查看是否成功
anaconda-ks.cfgproject
[root@CentOS7_29~]#cdproject/#进入仓库
[root@CentOS7_29project]#ls-a#查看是否有问题,
....git
[root@CentOS7_29project]#echo"print'sunshine'">code.py#在仓库新建文件
[root@CentOS7_29project]#gitstatus#查案状态
#Onbranchmaster
#
#Initialcommit
#
#Untrackedfiles:
#(use"gitadd<file>..."toincludeinwhatwillbecommitted)
#
#	code.py
nothingaddedtocommitbutuntrackedfilespresent(use"gitadd"totrack)
[root@CentOS7_29project]#gitaddcode.py#加入暂存区
[root@CentOS7_29project]#gitcommit-m"v0.1"#commit并说明,第一次会提示输入用户更邮箱

***Pleasetellmewhoyouare.

Run

gitconfig--globaluser.email"you@example.com"
gitconfig--globaluser.name"YourName"

tosetyouraccount'sdefaultidentity.
Omit--globaltosettheidentityonlyinthisrepository.

fatal:unabletoauto-detectemailaddress(got'root@CentOS7_29.(none)')
[root@CentOS7_29project]#gitconfig--globaluser.email"sunshine@sunshine.com"#设置邮箱
[root@CentOS7_29project]#gitconfig--globaluser.namesunshine#设置用户
[root@CentOS7_29project]#gitconfig--globalcolor.uiauto#设置颜色
[root@CentOS7_29project]#gitcommit-m"v0.1"#再次提交
[master(root-commit)4d0d265]v0.1
1filechanged,1insertion(+)
createmode100644code.py
[root@CentOS7_29project]#gitlog
commit4d0d265d8511f338abb8b4e0652c3a1a6656a892
Author:sunshine<sunshine@sunshine.com>
Date:TueOct1121:33:372016+0800

v0.1
[root@CentOS7_29project]#gitlog--oneline#查看log
4d0d265v0.1
[root@CentOS7_29project]#gitpushoriginmaster#push失败,因为git不止写操作
fatal:remoteerror:accessdeniedorrepositorynotexported:/project.git

3、在centos7_30服务器配置使用htto协议

[root@CentOS7_30project.git]#pwd#进入项目仓库
/var/lib/git/project.git
[root@CentOS7_30project.git]#gitconfighttp.receivepacktrue#配置gitconfig即可
[root@CentOS7_30~]#yuminstallhttpd-y#安装httpd
[root@CentOS7_30~]#httpd-M|grep-Ei"\<(alias|cgi|env)"#必须要有这三个模块
AH00557:httpd:apr_sockaddr_info_get()FailedforCentOS7_30
AH00558:httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1.Setthe'ServerName'directivegloballytosuppressthismessage
alias_module(shared)
env_module(shared)
cgi_module(shared)
[root@CentOS7_30~]#vim/etc/httpd/conf/httpd.conf#编辑httpd文件,注销中心主机
注销DocumentRoot中心主机
[root@CentOS7_30~]#vim/etc/httpd/conf.d/git.conf#新增git.conf定义虚拟主机
<VirtualHost*:80>#定义端口
	ServerNamegit.sunshine.com#定义域名
	SetEnv	GIT_PROJECT_ROOT/var/lib/git#定义项目路径
	SetEnv	GIT_HTTP_EXPORT_ALL#使用HTTP导出
	ScriptAlias/git//usr/libexec/git-core/git-http-backend/#千万注意如果git后面没有/那么git-http-backend后面也一定不能有/
	<Directory"/usr/libexec/git-core/">#该目录下好像都是一些prel脚本
		OptionsExecCGIIndexes
		Requireallgranted
	</Directory>
	<LocationMatch"^/git/.*/git-receive-pack$">#匹配我们定义的
		AuthTypeBasic#使用标准认证
		AuthName"sunshinetestproject."#描述
		AuthUserFile/etc/httpd/conf/.htpasswd#存放账户密码的地方
		Requirevalid-user
	</LocationMatch>
</VirtualHost>
[root@CentOS7_30~]#chown-Rapache.apache/var/lib/git/#设定用户及用户组,不设定那么你是没权限的
[root@CentOS7_30git-core]#htpasswd-c-m/etc/httpd/conf/.htpasswdtom#创建账户密码第一次使用-c
Newpassword:
Re-typenewpassword:
Addingpasswordforusertom
[root@CentOS7_30git-core]#htpasswd-m/etc/httpd/conf/.htpasswdjerry#创建账户密码第二次不要使用-c,不然你就一直就是一个用户
Newpassword:
Re-typenewpassword:
Addingpasswordforuserjerry
[root@CentOS7_30git-core]#systemctlstarthttpd.service#启动httpd服务:::*
[root@CentOS7_30git-core]#ss-tnl|grep80#查看是否启动成功
LISTEN0128:::80:::*

4、在centos7_29客户端pull以及push

[root@CentOS7_29~]#cat/etc/hosts#编辑hosts增加域名host
127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4
::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6
192.168.11.30git.sunshine.com
[root@CentOS7_29~]#gitclonehttp://git.sunshine.com/git/project.git#使用http协议clone
cloninginto'project'...
warning:Youappeartohaveclonedanemptyrepository.
[root@CentOS7_29~]#cdproject/#进入project仓库
[root@CentOS7_29project]#ls#查看仓库
[root@CentOS7_29project]#!echo#创建python脚本
echo"print'sunshine'">code.py#该为完整命令,上面的使用记录!
[root@CentOS7_29project]#gitaddcode.py#条件脚本gitadd
[root@CentOS7_29project]#gitcommit-m"v0.1"#commit并说明
[master(root-commit)d847298]v0.1
1filechanged,1insertion(+)
createmode100644code.py
[root@CentOS7_29project]#gitpushoriginmaster#push至远程仓库
Countingobjects:3,done.
Writingobjects:100%(3/3),215bytes|0bytes/s,done.
Total3(delta0),reused0(delta0)
Usernamefor'http://git.sunshine.com':tom#提示输入账号,输入创建的tom
Passwordfor'http://tom@git.sunshine.com':#输入密码,就可以提交成功
Tohttp://git.sunshine.com/git/project.git
*[newbranch]master->master

docker push 报错Get https://10.100.9.97:5000/v1/_ping: http: server gave HTTP response to HTTPS client

docker push 报错Get https://10.100.9.97:5000/v1/_ping: http: server gave HTTP response to HTTPS client

centos7下运行docker push 10.100.9.97:5000/Nginx:1.19报错:

  Get https://10.100.9.97:5000/v1/_ping: http: server gave HTTP response to HTTPS client

 

解决方法:

vi /etc/docker/daemon.json

{
"registry-mirrors": [
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"dns": ["8.8.8.8","8.8.4.4"],
"insecure-registries":["10.100.9.97:5000"]
}

 

systemctl restart docker

 

git http push 报错求解

git http push 报错求解

我在 linux 服务器上搭建了 git 与 apache 集成,之后在另一台 linux 系统下使用 http 协议进行 clone、commit、push 都可以,但我在我电脑上装了 git bash 、TortoiseGit 1.8.6.0、eclipse,做同样的操作,push 时报错都是提示远程不支持智能协议 http push;这是什么原因,求解!!!!

git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案

git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案

git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案

error: unable to rewind rpc post data - try increasing http.postBuffer

error: RPC failed; curl 56 Recv failure: Connection was aborted

fatal: The remote end hung up unexpectedly

当使用git 一次提交的数据过大时,会出现以上错误,按照提示我们增大postBuffer

git config http.postBuffer 524288000,改为最大500M 具体值先检查一下原始工程)

http 连接方式 ,一般的问题,用增加postBuffer一般可以解决,但对于超大的代码(700MB+,我的经验)加了这个缓存没用,

 

 

显示详细信息

GIT_CURL_VERBOSE=1 git push -u origin master

 

 

改到很大后(检测要提交代码的大小,并设置postBuffer为对应大小,如果太大会出现以下错误

error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

解决办法:在部署NGINX(Apache思路相同)做反向代理的gitlab服务器所在机器(容器运行时,仅需要更改主机即可),更改client_max_body_size配置。

这是因为nginx的配置中进行了限制(我这里nginx作为反向代理),对proxy_pass.conf(也可以是nginx.conf,根据实际情况)中的相应参数进行放大,解决了此问题。

 

 

client_max_body_size 512M;(更改前 128m)

client_body_buffer_size 512k;(更改前 64k)

 

proxy_connect_timeout 300;

proxy_send_timeout 300;

proxy_read_timeout 300;

 

proxy_buffer_size 16k;

proxy_buffers 4 16k;

proxy_busy_buffers_size 48k;

 

proxy_temp_file_write_size 512k;(更改前 64k)

proxy_max_temp_file_size 512m;(更改前 128m)

 

今天关于git push to nginx + git-http-backend:error:无法访问URL http返回码22致命:git-http-push失败的讲解已经结束,谢谢您的阅读,如果想了解更多关于Centos 7 Git+httpd 基于密码认证push、docker push 报错Get https://10.100.9.97:5000/v1/_ping: http: server gave HTTP response to HTTPS client、git http push 报错求解、git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案的相关知识,请在本站搜索。

本文标签: