Git Errors and Fixes

Git Errors and Fixes

Git Clone Over Http Returns 500 errors

Summary:

When you clone, push and pull changes between Gitlab repositories and your computer there are two network protocols, one is HTTPS and the other one is SSH.. If Gitlab uses Apache instead of built-in Nginx server and if you are able to clone over SSH but not over http, have to check Apache related configurations. Here we are going to see some solutions to fix 500 errors.

Git-Clone-Over-Http

Expected behavior:

Cloned repo.

Actual behavior:

Error 500.

Solution:

HTTP status code 500 usually indicates that there is an issue with the remote end and not a problem on your client side.

  • ModSecurity rules may block, ModSecurity helps to block potential attack attempts from malicious users, but sometimes it can also block legitimate requests. If ModSecurity rules block Cloning process, find out the Rule ID from Apache error logs and whitelist it (or) disable Modsecurity rules for the certain domain to get a successful result over the http.
  • Check server memory. If the server is running out of Memory, try to run the program after increased Memory.
  • Increase the Git buffer size to the largest individual file size of your repo:

Git-Clone-Over-Http-1

Git clone over SSH returns fatal error

Summary:

If we choose Gitlab installation from source, Gitlab will be available under /home/git and we create an username called “git”. On cloning, the git creates a directory, fails to authenticate the user then it keeps prompting for the password.

Git-Clone-Over-Http-2

Solution:

Check the Gitlab directory permission and ownership, files and folders should be read and writable by the “git” user.

Git-Clone-Over-Http-3

Syntax error in Gitlab

Summary:

If Gitlab installed from source, we have to use ‘bundle exec rake’ command to execute some tasks. Why ‘bundle exec’? running any executable without ‘bundle exec’ will have Rubygems fetching the latest version of the gem installed in your system. By adding the ‘bundle exec’ prefix instead will have the executable running in the context of your Gemfile.lock, which means tasks will be run using the version defined in the Gem file.

Git-Clone-Over-Http-4

Expected behavior:

The command should run without any errors.

Git-Clone-Over-Http-5

Solution:

From the error message, the Gemfile file syntax is based on Ruby 1.8.x which is an older version of Ruby and no longer supported. Gitlab gems may be using the system Ruby that needs to be removed so make sure the bundle executable doesn’t have system ruby. The command will give you the version details of Ruby.

Git-Clone-Over-Http-6

If you can find the older version of Ruby, then remove it using yum erase command as given below,

Git-Clone-Over-Http-7

Written by actsupp-r0cks