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
45.01k stars 5.49k forks source link

Panic during clone (with deployment key) #360

Closed thibaultmeyer closed 7 years ago

thibaultmeyer commented 7 years ago

I use the master version compiled 4 days ago. I got a panic error when cloning from SSH (git clone git@git.pa...).

It seems only clone with deployment keys raise this error

Cloning into '/opt/caddy-server/tmp/cashless-api-documentation'...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x47d6d1]

goroutine 1 [running]:
panic(0xdab1a0, 0xc420010090)
        /opt/go/src/runtime/panic.go:500 +0x1a1
code.gitea.io/gitea/cmd.runServ(0xc4202cf900, 0x0, 0xc4202cf900)
        /home/centos/gitea/src/code.gitea.io/gitea/cmd/serve.go:261 +0x871
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0xd803c0, 0xf19780, 0xc4202cf900, 0xc420015d00, 0x0)
        /home/centos/gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb9
code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0xe7a551, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xeacd57, 0x2f, 0x0, ...)
        /home/centos/gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xcc7
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc4202bf1e0, 0xc42005c100, 0x4, 0x4, 0x0, 0x0)
        /home/centos/gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x6a3
main.main()
        /home/centos/gitea/src/code.gitea.io/gitea/main.go:42 +0x33f
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

*With the command `tail -f /opt/gitea/log/`**

tail: xorm.log: file truncated
[xorm] [info]  2016/12/07 10:47:19.662837 [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "enable_wiki", "enable_external_wiki", "external_wiki_url", "enable_issues", "enable_external_tracker", "external_tracker_url", "external_tracker_format", "external_tracker_style", "enable_pulls", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "owner_id"=$1 AND "lower_name"=$2 LIMIT 1 [args] [9 cashless-api-documentation]
[xorm] [info]  2016/12/07 10:47:19.664614 [sql] SELECT "id", "owner_id", "name", "fingerprint", "content", "mode", "type", "created_unix", "updated_unix" FROM "public_key" WHERE "id"=$1 LIMIT 1 [args] [2]
[xorm] [info]  2016/12/07 10:47:19.665941 [sql] SELECT "id", "key_id", "repo_id", "name", "fingerprint", "created_unix", "updated_unix" FROM "deploy_key" WHERE key_id = $1 AND repo_id = $2 LIMIT 1 [args] [2 16]
[xorm] [info]  2016/12/07 10:47:19.667166 [sql] SELECT "id", "key_id", "repo_id", "name", "fingerprint", "created_unix", "updated_unix" FROM "deploy_key" WHERE "key_id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [2 16]
[xorm] [info]  2016/12/07 10:47:19.667857 [sql] UPDATE "deploy_key" SET "key_id" = $1, "repo_id" = $2, "name" = $3, "fingerprint" = $4, "created_unix" = $5, "updated_unix" = $6 WHERE "id"=$7 [args] [2 16 documentation 76:9c:55:2b:b5:9c:af:2f:d0:9e:cb:95:3a:22:4b:05 1477295008 1481104039 2]

I can navigate on the repos from the Gitea WebUI and download repo from webUI works.

Bwko commented 7 years ago

This is fixed by #358 Just clone the latest master and recompile :)

thibaultmeyer commented 7 years ago

Just recompiled project from up-to-date master branch. This issue is fixed.