Making .git suffix for repository URLs optional

Mark Petrovic August 23, 2014

Hi.

The Go language has a tool to fetch content from git repositories, build the result, and install a binary along GOPATH/bin.

Here is an example that works, but installs the binary strappy as "strappy.git", which is a slight misnomer.

$ go get stash.example.com:7990/scm/inf/strappy.git

Of course, I do not want to forbid repository URLs ending in .git, but I would like to make it optional so I could do this

$ go get stash.example.com:7990/scm/inf/strappy

Is this possible in Stash?

Thanks.

3 answers

1 accepted

0 votes
Answer accepted
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2014

Hi Mark,

Currently if you want to clone a repo in Stash you don't need to specify the .git extension even though the UI gives you the ".git" as the full URL for cloning.

You can have a look at STASH-4744 for reference as some of our devs commented on that.

Let us know if this answers your question.

Best regards,

Thiago Bomfim

Atlassian Support - Stash

Mark Petrovic September 8, 2014

Thiago, one more question on this subject. The port number in our clone URLs is causing "go get ..." problems. Is it possible to configure Stash to use meta tags as documented here: https://golang.org/cmd/go/#hdr-Remote_import_paths To illustrate, I would use this import in my Go application code import "example.com/scm/inf/strappy" and the meta tag in the HTTP HEAD would map this to http://example.com:7990/scm/inf/strappy.git The endgame for us here is that we have a lot of already-cloned repositories with a port number in them. And Go cannot handle, nor will it anytime soon if ever, the port in the host part of the import path spec. So to use Go effectively with Stash, I have to a) change all the cloned URLs on all developer desktops to a form without the port and change where Stash listens to http clone requests, or b) port forward at the internal load balancer port 80 to port 7990 to remove the user-facing port spec, or c) this meta tag trick. Thanks for listening.

ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 9, 2014

Hi Mark, What I understood from your question is that you want to be able to perform Git operations both using the standard port 80 and the 7990 in which the Tomcat is running. Is my understanding correct? If that's the case, why don't you set up a reverse proxy in front of Stash? We have a documentation to help you with that: https://confluence.atlassian.com/display/STASH/Integrating+Stash+with+Apache+HTTP+Server You could install Apache where Stash is running, for instance. In that scenario, you would have Apache listening on port 80 and Stash listening on its 7990 Connector. I hope that helps. Best regards, Thiago Bomfim Atlassian Support - Stash

Kerry Lynn January 6, 2015

Thiago, What Mark is alluding to as option c) above is a feature of go get that will perform the mapping based on a meta tag in the fetched repo's HTML HEAD. Is it possible to modify this in stash? For example, import "example.com/scm/inf/strappy" will result in the following request(s): https://example.com/scm/inf/strappy?go-get=1 (preferred) http://example.com/scm/inf/strappy?go-get=1 (fallback) If that page contains the meta tag <meta name="go-import" content="example.com/scm/inf/ git https://example.com:7990/scm/inf/strappy">; the go tool will verify that https://example.com/scm/inf/?go-get=1 contains the same meta tag and then git clone https://example.com:7990/scm/inf/strappy into GOPATH/src/example.com/scm/inf/. The question is whether meta tags can be returned as part of a repo get? It seems that UI pages in stash can be "decorated": https://developer.atlassian.com/stash/docs/latest/reference/plugin-decorators.html

1 vote
Peter Dalinis February 11, 2015

There are JIRA 2 issues that I have found:

One looks like it is addressed, but meta tag support appears to not be on Atlassian's radar.

Gitlab fixed this a while ago: https://github.com/gitlabhq/gitlabhq/issues/5769

It would be nice if Atlassian could keep up with their competitors. Golang is growing very fast and I hope the last thing Atlassian wants is to be an impediment to their customers.

We are really struggling with wanting to keep our source in Stash.

0 votes
Stefan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2015

Further support for go get was added in Stash 3.8.0.

https://jira.atlassian.com/browse/STASH-5380

Kind regards,
Stefan Petrucev
Atlassian Stash

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events