Unable to push solution after GitLab7 is upgraded to 8.2

Source: Internet
Author: User

Unable to push solution after GitLab7 is upgraded to 8.2

I upgraded gitlab7 to 8.2 and found that the http Protocol cannot be pushed. The error is as follows: ssh protocol is acceptable.

Error: Cannot access URL https: // git... /Repo. git/, return code 22 fatal: git-http-push failed error: failed to push some refs to 'https: // git... /Repo. git'

After a long time, we used our own nginx and didn't use gitlab's built-in features. The problem is here. What is gitlab-workhorse in the new version of gitlab. You can solve the problem by configuring nginx as follows. Record this.

# GitLab
##
# Lines starting with two hashes (#) are comments with information.
# Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
##################################
# CONTRIBUTING ##
##################################
##
# If you change this file in a Merge Request, please also create
# A Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
##
##################################
# Chunked transfer ##
##################################
##
# It is a known issue that Git-over-HTTP requires chunked transfer encoding [0]
# Which is not supported by Nginx <1.3.9 [1]. As a result, pushing a large object
# With Git (I. e. a single large file) can lead to a 411 error. In theory you can get
# Around this by tweaking this configuration file and either:
#-Installing an old version of Nginx with the chunkin module [2] compiled in, or
#-Using a newer version of Nginx.
##
# At the time of writing we do not know if either of these theoretical solutions works.
# As a workaround users can use Git over SSH to push large files.
##
# [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
# [1] https://github.com/agentzh/chunkin-nginx-module#status
# [2] https://github.com/agentzh/chunkin-nginx-module
##
###################################
# Configuration ##
###################################
##
# See installation. md # using-https for additional HTTPS configuration details.

Upstream gitlab {
Server unix:/var/opt/gitlab-rails/sockets/gitlab. socket fail_timeout = 0;
}

Upstream gitlab-workhorse {
Server unix:/var/opt/gitlab-workhorse/socket;
}

# Normal HTTP host
Server {
# Either remove "default_server" from the listen line below,
# Or delete the/etc/nginx/sites-enabled/default file. This will cause gitlab
# To be served if you visit any address that your server responds to, eg.
# The ip address of the server (http://x.x.x.x/) n 0.0.0.0: 80 default_server;
Listen 0.0.0.0: 80 default_server;
Listen [:]: 80 default_server;
Server_name YOUR_SERVER_FQDN; # Replace this with something like gitlab.example.com
Server_tokens off; # Don't show the nginx version number, a security best practice
Root/opt/gitlab/embedded/service/gitlab-rails/public;

# Increase this if you want to upload large attachments
# Or if you want to accept large git objects over http
Client_max_body_size 20 m;

# See app/controllers/application_controller.rb for headers set

# Individual nginx logs for this GitLab vhost
Access_log/var/log/nginx/gitlab_access.log;
Error_log/var/log/nginx/gitlab_error.log;

Location /{
# Serve static files from defined root folder.
##@ Gitlab is a named location for the upstream fallback, see below.
Try_files $ uri/index.html unzip uri.html @ gitlab;
}

# We route uploads through GitLab to prevent XSS and enforce access control.
Location/uploads /{
# If you use HTTPS make sure you disable gzip compression
# To be safe against BREACH attack.
# Gzip off;

# Https://github.com/gitlabhq/gitlabhq/issues/694
# Some requests take more than 30 seconds.
Proxy_read_timeout 300;
Proxy_connect_timeout 300;
Proxy_redirect off;

Proxy_set_header Host $ http_host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header X-Forwarded-Proto $ scheme;
Proxy_set_header X-Frame-Options SAMEORIGIN;

Proxy_pass http: // gitlab;
}

# If a file, which is not found in the root folder is requested,
# Then the proxy passes the request to the upsteam (gitlab unicorn ).
Location @ gitlab {

# Https://github.com/gitlabhq/gitlabhq/issues/694
# Some requests take more than 30 seconds.
Proxy_read_timeout 300;
Proxy_connect_timeout 300;
Proxy_redirect off;

Proxy_set_header Host $ http_host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header X-Forwarded-Proto $ scheme;
Proxy_set_header X-Frame-Options SAMEORIGIN;

Proxy_pass http: // gitlab;
}

Location ~ ^/[\ W \.-] +/[\ w \.-] +/gitlab-lfs/objects {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

Location ~ ^/[\ W \.-] +/[\ w \.-] +/(info/refs | git-upload-pack | git-receive-pack) $ {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

Location ~ ^/[\ W \.-] +/[\ w \.-] +/repository/archive {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

Location ~ ^/Api/v3/projects/. */repository/archive {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

# Build artifacts shocould be submitted to this location
Location ~ ^/[\ W \.-] +/[\ w \.-] +/builds/download {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

# Build artifacts shocould be submitted to this location
Location ~ /Ci/api/v1/builds/[0-9] +/artifacts {
Client_max_body_size 0;
# 'Error' 418 is a hack to re-use the @ gitlab-workhorse block
Error_page 418 = @ gitlab-workhorse;
Return 418;
}

Location @ gitlab-workhorse {

# If you use HTTPS make sure you disable gzip compression
# To be safe against BREACH attack.
# Gzip off;

# Https://github.com/gitlabhq/gitlabhq/issues/694
# Some requests take more than 30 seconds.
Proxy_read_timeout 300;
Proxy_connect_timeout 300;
Proxy_redirect off;

# Do not buffer Git HTTP responses
Proxy_buffering off;

# The following settings only work with NGINX 1.7.11 or newer
#
# Pass chunked request bodies to gitlab-workhorse as-is
# Proxy_request_buffering off;
# Proxy_http_version 1.1;

Proxy_set_header Host $ http_host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header X-Forwarded-Proto $ scheme;

Proxy_pass http: // gitlab-workhorse;
}

# Enable gzip compression as per rails guide:
# Http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
# WARNING: If you are using relative urls remove the block below
# See config/application. rb under "Relative url support" for the list
# Other files that need to be changed for relative url support
Location ~ ^/(Assets )/{
Root/opt/gitlab/embedded/service/gitlab-rails/public;
Gzip_static on; # to serve pre-gzipped version
Expires max;
Add_header Cache-Control public;
}

Error_page 502/502 .html;
}

For more GitLab tutorials, see the following:

GitLab Installation Guide in Ubuntu 14.04

How to install Gitlab in Ubuntu Server 14.04

Install GitLab in Chinese with CentOS source code

Install GitLab on Ubuntu 12.04

GitLab 5.3 upgrade considerations

Deploy GitLab on CentOS (self-managed Git project repository)

Install GitLab 6.0.2 on RHEL6/CentOS6/ScientificLinux6

CentOS 6.5 GitLab installation tutorial and Related Problems

Upgrade GitLab to 8.2.0

GitLab details: click here
GitLab: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.