go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.6k stars 5.45k forks source link

Internal Server Error upon creating new pre-initialized repository #3206

Closed strk closed 3 years ago

strk commented 6 years ago

As of bdf18560110ac642c196054be38729760a4bbc39 (1.3.0-dev) installed locally, creating a new repository and requesting to initialize it ends up returning a 500 internal server error. Console outputs do not show anything interesting other than:

2017/12/16 21:42:59 [I] [SQL] INSERT INTO "action" ("user_id","op_type","act_user_id","repo_id","comment_id","is_deleted","ref_name","is_private","content","created_unix") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id" []interface {}{3, 1, 3, 2, 0, false, "", false, "", 1513456979} 2017/12/16 21:42:59 [I] [SQL] ROLL BACK [Macaron] 2017-12-16 21:42:59: Completed /repo/create 500 Internal Server Error in 43.473658ms

Log shows:

2017/12/16 21:42:59 [...routers/repo/repo.go:123 handleCreateError()] [E] CreatePost: initRepository: initRepository: path already exists: /home/strk/gitea-repositories/strk/test.git

At the end of this, on the filesystem there's no such repository

lunny commented 6 years ago

@strk @lafriks This should not be a bug. This issue indicates your database repo record was deleted but the file system repository was not.

lafriks commented 6 years ago

@lunny but it should fail with normal error message not with internal server error

Larivact commented 5 years ago

This error can currently be reproduced with the demo site: https://try.gitea.io/repo/create

zeripath commented 5 years ago

hmm... @Larivact how did you replicate this on try?

zeripath commented 5 years ago

I think I agree with @lafriks though - it shouldn't be a 500, we should probably handle this more nicely and just adopt the repository informing the user.

Larivact commented 5 years ago

I created an account and attempted to create a repository entering just a name and checking Initialize Repository (Adds .gitignore, License and README).

zeripath commented 5 years ago

@Larivact that's a very likely a different bug - this bug is specifically about the case where you have repositories already in your gitea-repositories directory and you are effectively trying to get gitea to adopt these new repos. Did you manage to do this on try? If so, please explain how you did this.

If not, you should open a new bug report for the issue you experienced, and try to tell us as much information about how you got the 500 as possible as I can't replicate this immediately at present.

lunny commented 5 years ago

@Larivact haven't reproduce on try.gitea.io, could you give more details?

Larivact commented 5 years ago

I apologize for commenting on the wrong issue. I encountered a different bug, for which I just opened #5772.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

midacts commented 4 years ago

I ran into this today as well (I'm new to Gitea and it was my first repo). I created a new repo and selected "Initialize Repository (Adds .gitignore, License and README)".

After selecting to create the repo i got a 500 error (as above). After deleting the repo and not selecting that setting, it worked as intended.