Git Commands Return Error Code 400

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Problem #1:

When trying to create repositories, Git commands return error code 400:

The following can be seen in the atlassian-bitbucket.log:


2012-10-08 15:04:10,147 INFO [http-7990-32] blah 904x33x1 ky07q7 143.88.25.110 "POST /projects/TEST/repos HTTP/1.1" c.a.s.internal.scm.git.CreateCommand Repository t1 has been created and configured successfully 2012-10-08 15:04:26,327 ERROR [http-7990-8] blah 904x38x1 1e7prrh 143.88.25.110 "GET /scm/TEST/t1.git/info/refs HTTP/1.1" c.a.s.i.scm.git.web.GitSmartRequest Request for repo 't1' of project 'TEST' from 'IP' failed: read process '/usr/local/bin/git http-backend /info/refs' caused an exception Process's error output: warning: unable to access '/root/etc/gitconfig': Permission denied warning: unable to access '/root/etc/gitconfig': Permission denied warning: unable to access '/root/etc/gitconfig': Permission denied warning: unable to access '/root/etc/gitconfig': Permission denied git: 'http-backend' is not a git command. See 'git --help'.


Problem #2:

When running git commands on your CI applications (i.e. Jenkins), with Bitbucket server DEBUG logs on - refer to Enable debug logging.

The following can be seen on your CI system:


Failed to connect to repository : Command "/usr/bin/git -c core.askpass=true ls-remote -h http://jenkins@mybitbucketserver.com:7990/scm/TT/test.git HEAD" returned status code 128:
stdout: 
stderr: error: The requested URL returned error: 400 Bad Request while accessing http://jenkins@mybitbucketserver.com:7990/scm/TT/test.git/info/refs


The following can be seen on your Bitbucket Server atlassian-bitbucket.log:

2016-08-26 14:48:20,317 DEBUG [http-nio-7990-exec-3117] @H5FYGBx888x863255x0 10.138.28.33 "GET /scm/TT/test.git/info/refs HTTP/1.1" c.a.s.i.s.g.p.h.DefaultGitHttpScmRequestHandler It looks like we've received a 'dumb' protocol git request. service=null, pathInfo=/TT/test.git/info/refs
<IP> | http | i@H5FYGBx888x863255x0 | - | 2016-08-26 14:48:20,310 | "GET /scm/TT/test.git/info/refs HTTP/1.1" | "" "git/1.7.1" | - | - | - |
<IP> | http | o@H5FYGBx888x863255x0 | - | 2016-08-26 14:48:20,318 | "GET /scm/TT/test.git/info/refs HTTP/1.1" | "" "git/1.7.1" | - | 8 | - |


Cause

Problem #1:

This happens because the Git server is trying to use the git "dumb" HTTP protocol, which is not supported by Bitbucket Server. Bitbucket Server supports only the "smart" HTTP protocol, which was introduced in Git 1.6.6.

Problem #2:

The Git client is performing a dumb protocol request because it is an old version.

Resolution

Problem #1:

Update the Git on the system running your Bitbucket server to a supported one (1.6.6 and above).

Problem #2:

Update the Git client to something higher the Git 1.7.1. Although Git dumb protocol is supposed to be used on any Git client above 1.6.6 (see 4.1 Git on the Server - The Protocols). Please upgrade upgrade your Git client to the most of recent supported one as described on our Supported Platforms.

Last modified on Apr 4, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.