Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

go get and bitbucket

Deleted user July 6, 2016

It appears that our internally hosted Bitbucket host is serving up incorrect meta-tags for the "go get" command in Google go.

curl -i http://david.x.johnson@myhost.com/scm/pid/catena?go-get=1
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: @9UI3HTx1348x608596x0
X-ASEN: SEN-3351873
Transfer-Encoding: chunked
Date: Thu, 07 Jul 2016 03:28:07 GMT

<!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta name="go-import" content="myhost.com/scm/pid git http://myhost.com/scm/scm/pid.git">
    </head>
    <body>
    </body>
</html>

 

What I'm expecting back for the meta-tag name go-import is something like the following:

 

<meta name="go-import" content="myhost.com/scm/pid/catena git http://myhost.com/scm/pid/catina.git">

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Stefan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2016

Hi David,

When using the go get command with Bitbucket Server, the correct syntax is

go get {hostname}/{project_key}/{repo_slug}

which will lead to go get making a request to

http://{hostname}/{project_key}/{repo_slug}?go-get=1

and scanning the response for a go-import like the following.

<meta name="go-import" content="{hostname}/{project_key}/{repo_slug} git https://{hostname}/scm/{project_key}/{repo_slug}.git">

Note that this syntax is similar to the clone URL, but without the /scm part. In your case, the following request should work.

go get myhost.com/pid/catena

Please refer to https://jira.atlassian.com/browse/BSERV-5380 for further information on go get with Bitbucket Server.

Best regards,
Stefan Petrucev
Atlassian Bitbucket 

wbh1 February 25, 2019

This finally solved the problem I've been trying to resolve! Thanks, Stefan! :)

Like aleksandervagin likes this
2 votes
Jonas Falck February 27, 2018

You could also solve ssh access with ssh config ether in /etc/ssh/ssh_config or ~/.ssh/config

Host bitbucket.your.url
    Port 7999
    User git
1 vote
theory May 26, 2017

And if you're using an internally-hosted BitBucket that requires SSH cloning on a specific port, you can tell Git to always use SSH like so:

git config --global url."ssh://git@source.example.com:7999/".insteadOf \
"https://source.example.com/scm/"

So whenever Git sees a URL starting with {{https://source.example.com/scm/}}, it will replace it with {{ssh://git@source.example.com:7999/}}.

 

TAGS
AUG Leaders

Atlassian Community Events