Skip to content

Instantly share code, notes, and snippets.

@int128
Last active August 18, 2017 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int128/c3c6a6d9955bd0fcc3ac0ba19da1d987 to your computer and use it in GitHub Desktop.
Save int128/c3c6a6d9955bd0fcc3ac0ba19da1d987 to your computer and use it in GitHub Desktop.
Testing GitHub compatible URL access on GitBucket

Prerequisite

  • Install and configure GitBucket at http://localhost:8080
  • Deny anonymous access
  • Create a group hello
  • Create a repository hello/foo with README.md

Test cases

GIT_CURL_VERBOSE=1 git ls-remote http://localhost:8080/hello/foo 2>&1 | egrep -v '^\*'
GIT_CURL_VERBOSE=1 git clone http://localhost:8080/hello/foo 2>&1 | egrep -v '^\*'

Change README.md on GitBucket.

GIT_CURL_VERBOSE=1 git fetch origin 2>&1 | egrep -v '^\*'

Change README.md on GitBucket and commit it.

GIT_CURL_VERBOSE=1 git push origin 2>&1 | egrep -v '^\*'
> GET /hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 18 Aug 2017 09:38:45 GMT
< Set-Cookie: JSESSIONID=1pks26itq37hl1k59neyh7cecy;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Location: http://localhost:8080/git/hello/foo/info/refs?service=git-upload-pack
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
< Date: Fri, 18 Aug 2017 09:38:45 GMT
< WWW-Authenticate: BASIC realm="GitBucket"
< Content-Type: text/html; charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 313
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:38:45 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-advertisement
< Content-Encoding: gzip
< Content-Length: 227
< Server: Jetty(9.2.1.v20140609)
<
warning: redirecting to http://localhost:8080/git/hello/foo/
> POST /git/hello/foo/git-upload-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 163
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:38:46 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-result
< Transfer-Encoding: chunked
< Server: Jetty(9.2.1.v20140609)
<
> GET /hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 18 Aug 2017 09:40:13 GMT
< Set-Cookie: JSESSIONID=15k67zbqp6dvz1d01ygmdw7ndj;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Location: http://localhost:8080/git/hello/foo/info/refs?service=git-upload-pack
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
< Date: Fri, 18 Aug 2017 09:40:13 GMT
< WWW-Authenticate: BASIC realm="GitBucket"
< Content-Type: text/html; charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 313
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:40:14 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-advertisement
< Content-Encoding: gzip
< Content-Length: 227
< Server: Jetty(9.2.1.v20140609)
<
warning: redirecting to http://localhost:8080/git/hello/foo/
> POST /git/hello/foo/git-upload-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 625
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:40:14 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-result
< Transfer-Encoding: chunked
< Server: Jetty(9.2.1.v20140609)
<
From http://localhost:8080/hello/foo
8e82022..92af78f master -> origin/master
> GET /hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 18 Aug 2017 09:36:45 GMT
< Set-Cookie: JSESSIONID=1nczo6mypsi9zvp6f1smn4nci;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Location: http://localhost:8080/git/hello/foo/info/refs?service=git-upload-pack
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
< Date: Fri, 18 Aug 2017 09:36:45 GMT
< WWW-Authenticate: BASIC realm="GitBucket"
< Content-Type: text/html; charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 313
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-upload-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:36:45 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-advertisement
< Content-Encoding: gzip
< Content-Length: 227
< Server: Jetty(9.2.1.v20140609)
<
warning: redirecting to http://localhost:8080/git/hello/foo/
8e82022a9c4a3e92ca477ddbbd4467ba4f04307e HEAD
8e82022a9c4a3e92ca477ddbbd4467ba4f04307e refs/heads/master
> GET /hello/foo/info/refs?service=git-receive-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 18 Aug 2017 09:43:03 GMT
< Set-Cookie: JSESSIONID=179zdtukwgx6hdpbvr3zvbnu0;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Location: http://localhost:8080/git/hello/foo/info/refs?service=git-receive-pack
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-receive-pack HTTP/1.1
Host: localhost:8080
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
< Date: Fri, 18 Aug 2017 09:43:03 GMT
< WWW-Authenticate: BASIC realm="GitBucket"
< Content-Type: text/html; charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 313
< Server: Jetty(9.2.1.v20140609)
<
> GET /git/hello/foo/info/refs?service=git-receive-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:43:04 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-receive-pack-advertisement
< Content-Length: 191
< Server: Jetty(9.2.1.v20140609)
<
warning: redirecting to http://localhost:8080/git/hello/foo/
remote: Updating references: 100% (1/1)
> POST /git/hello/foo/git-receive-pack HTTP/1.1
Host: localhost:8080
Authorization: Basic cm9vdDpyb290
User-Agent: git/2.14.1.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-receive-pack-request
Accept: application/x-git-receive-pack-result
Content-Length: 460
< HTTP/1.1 200 OK
< Date: Fri, 18 Aug 2017 09:43:04 GMT
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-receive-pack-result
< Transfer-Encoding: chunked
< Server: Jetty(9.2.1.v20140609)
<
To http://localhost:8080/hello/foo
92af78f..ef19f96 master -> master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment