Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"go get" breaks with git/http between 0.9.x and 0.10.x (URL changes?) #4226

Closed
2 of 6 tasks
iaburton opened this issue Mar 2, 2017 · 4 comments
Closed
2 of 6 tasks
Labels
💊 bug Something isn't working status: needs feedback Tell me more about it
Milestone

Comments

@iaburton
Copy link

iaburton commented Mar 2, 2017

  • Gogs version (or commit ref): 0.9.97 - 0.10.1
  • Git version: 1.8.3.1
  • Operating system: Centos 6
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gogs.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist (usually found in log/gogs.log):

Drone test build with gogs 0.9.141
[Macaron] 2017-03-02 14:52:56: Started GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml for 192.168.2.134
[Macaron] 2017-03-02 14:52:56: Completed /api/v1/repos/Ian/test/raw/v0.6/drone.yml 200 OK in 59.789438ms
[Macaron] 2017-03-02 14:52:56: Started GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml.sig for 192.168.2.134
[Macaron] 2017-03-02 14:52:56: Completed /api/v1/repos/Ian/test/raw/v0.6/drone.yml.sig 404 Not Found in 68.977499ms
[Macaron] 2017-03-02 14:52:58: Started GET /Ian/test.git/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:58: Completed /Ian/test.git/info/refs?service=git-upload-pack 401 Unauthorized in 5.056218ms
[Macaron] 2017-03-02 14:52:58: Started GET /Ian/test.git/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:59: Completed /Ian/test.git/info/refs?service=git-upload-pack 200 OK in 207.832553ms
[Macaron] 2017-03-02 14:52:59: Started POST /Ian/test.git/git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:59: Completed /Ian/test.git/git-upload-pack 200 OK in 216.990109ms
[Macaron] 2017-03-02 14:52:59: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:59: Completed /devel/lflag/info/refs?service=git-upload-pack 401 Unauthorized in 4.995317ms
[Macaron] 2017-03-02 14:52:59: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:59: Completed /devel/lflag/info/refs?service=git-upload-pack 200 OK in 173.165033ms
[Macaron] 2017-03-02 14:52:59: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:52:59: Completed /devel/lflag/info/refs?service=git-upload-pack 401 Unauthorized in 3.947597ms
[Macaron] 2017-03-02 14:52:59: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:53:00: Completed /devel/lflag/info/refs?service=git-upload-pack 200 OK in 197.229813ms
[Macaron] 2017-03-02 14:53:00: Started POST /devel/lflag/git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 14:53:00: Completed /devel/lflag/git-upload-pack 200 OK in 161.1855ms

Same test build with gogs 0.10.1
[Macaron] 2017-03-02 10:22:52: Started GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml for 192.168.2.134
[Macaron] 2017-03-02 10:22:52: Completed GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml 200 OK in 82.855318ms
[Macaron] 2017-03-02 10:22:52: Started GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml.sig for 192.168.2.134
[Macaron] 2017-03-02 10:22:52: Completed GET /api/v1/repos/Ian/test/raw/v0.6/drone.yml.sig 404 Not Found in 71.046125ms
[Macaron] 2017-03-02 10:22:54: Started GET /Ian/test.git/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 10:22:54: Completed GET /Ian/test.git/info/refs?service=git-upload-pack 401 Unauthorized in 5.017977ms
[Macaron] 2017-03-02 10:22:54: Started GET /Ian/test.git/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 10:22:54: Completed GET /Ian/test.git/info/refs?service=git-upload-pack 200 OK in 193.957579ms
[Macaron] 2017-03-02 10:22:54: Started POST /Ian/test.git/git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 10:22:54: Completed POST /Ian/test.git/git-upload-pack 200 OK in 158.866432ms
[Macaron] 2017-03-02 10:22:55: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 10:22:55: Completed GET /devel/lflag/info/refs?service=git-upload-pack 404 Not Found in 7.975791ms
[Macaron] 2017-03-02 10:23:12: Started GET /devel/lflag/info/refs?service=git-upload-pack for 192.168.2.134
[Macaron] 2017-03-02 10:23:12: Completed GET /devel/lflag/info/refs?service=git-upload-pack 404 Not Found in 5.075256ms

Description

Hello,

I recently upgraded the gogs version I use at work from 0.9.97 to 0.10.1 and the upgrade appeared to go smoothly albeit for two things (the second one I think needs to be its own issue I'll make after this).

Our gogs setup is configured with webhooks that trigger drone (0.5) builds. After upgrading gogs versions it seems go get from inside the docker containers has stopped working and I'm having a hard time figuring out why. Reverting gogs to 0.9.97 and up to 0.9.141 fixes the problem.

Drone has a clone step that clones the repo that triggered the build before the rest of the build takes place, and currently this step works on 0.10.1 (so git is cloning/authing correctly with gogs) however the next step in the build is to run go get on the repo to pull the other Go deps (most of which are other gogs repos) and it is here where it fails. We use HTTP and SSH (not HTTPS) with gogs but the drone server simply pulls the http url (uses -insecure flag with go get) and uses a .netrc file with a users credentials in order to clone the repo (gogs is set to have registration closed which means you cannot clone without being a user)

In the log snippets above the 401 Unauthorized I believe come from the fact that git tries pulling the url first without the netrc and when it fails adds the auth info from netrc and tries again (why afterwards it succeeds with 200). I think the key URL is this one /devel/lflag/info/refs?service=git-upload-pack (where lflag is a Go dep of the test repo I setup). For versions 0.9.141 and below that URL exists and succeeds, but for 0.10.1 it returns 404.

Idk 100% if thats the issue, and I did look for similar issues here and through the release notes of the versions between 0.9.97 and 0.10.1 and didn't see why this would change. Below is a small snippet of the output from the build on drone

go get -v -d -insecure cd .; git ls-remote git://192.168.2.14:3000/devel/lflag fatal: repository 'http://192.168.2.14:3000/devel/lflag/' not found
The http url above does exist and works for older versions of gogs. I can reproduce this outside of drone by simply running the commands go get is. Let me know if there is more information needed, thank you.
...

@unknwon unknwon added 💊 bug Something isn't working status: needs reproduce Wait, how did that happen? labels Mar 3, 2017
@unknwon unknwon added this to the 0.11 milestone Mar 3, 2017
@unknwon unknwon added status: needs feedback Tell me more about it and removed status: needs reproduce Wait, how did that happen? labels Mar 5, 2017
unknwon added a commit that referenced this issue Mar 5, 2017
Sometimes user could simply request wrong URL, but if that wrong URL
has nothing related Git HTTP operations, HTTP Basic Authentication
should not prompted. Instead, clean 404 page should be presented.

The patch also supports Git HTTP operations without '.git' suffix
to the repository name, which addresses #4226 and #4189.
@unknwon
Copy link
Member

unknwon commented Mar 5, 2017

Patch has pushed to fix this issue, please test on develop branch or https://try.gogs.io.

@hochhaus
Copy link
Contributor

hochhaus commented Mar 6, 2017

I built from source on the develop branch (Gogs version 0.10.6.0305) and I am still seeing this issue:

ahochhaus@ahochhaus-pc:~/sg$ go get -v code.taxi/socialworkout/soyotto
Fetching https://code.taxi/socialworkout/soyotto?go-get=1
Parsing meta tags from https://code.taxi/socialworkout/soyotto?go-get=1 (status code 200)
package code.taxi/socialworkout/soyotto: unrecognized import path "code.taxi/socialworkout/soyotto" (parse https://code.taxi/socialworkout/soyotto?go-get=1: no go-import meta tags (meta tag localhost/socialworkout/soyotto did not match import path code.taxi/socialworkout/soyotto))

Is my gogs setup misconfigured or is this bug still open?

@unknwon
Copy link
Member

unknwon commented Mar 6, 2017

This is what I get:

➜  Go go get -v try.gogs.io/unknwon/hello
Fetching https://try.gogs.io/unknwon/hello?go-get=1
Parsing meta tags from https://try.gogs.io/unknwon/hello?go-get=1 (status code 200)
get "try.gogs.io/unknwon/hello": found meta tag main.metaImport{Prefix:"try.gogs.io/unknwon/hello", VCS:"git", RepoRoot:"https://try.gogs.io/unknwon/hello.git"} at https://try.gogs.io/unknwon/hello?go-get=1
try.gogs.io/unknwon/hello (download)
package try.gogs.io/unknwon/hello: no buildable Go source files in /Users/jiahuachen/Applications/Go/src/try.gogs.io/unknwon/hello

Which downloads package correctly.

@hochhaus
Copy link
Contributor

hochhaus commented Mar 6, 2017

Thanks. I have now fixed my config error and can confirm you fix works.

Long story short, my repo is setup as a local mirror and I incorrectly set the server.DOMAIN in app.ini.

@unknwon unknwon closed this as completed Mar 7, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💊 bug Something isn't working status: needs feedback Tell me more about it
Projects
None yet
Development

No branches or pull requests

3 participants