mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 10:39:38 -05:00
Can't clone a repository via ssh: Repository does not exist or you do not have access #618
Closed
opened 2025-11-02 03:30:05 -06:00 by GiteaMirror
·
82 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.0
v1.15.11
v1.17.0-dev
v1.16.0-rc1
v1.15.10
v1.15.9
v1.15.8
v1.15.7
v1.15.6
v1.15.5
v1.15.4
v1.15.3
v1.15.2
v1.15.1
v1.14.7
v1.15.0
v1.15.0-rc3
v1.14.6
v1.15.0-rc2
v1.14.5
v1.16.0-dev
v1.15.0-rc1
v1.14.4
v1.14.3
v1.14.2
v1.14.1
v1.14.0
v1.13.7
v1.14.0-rc2
v1.13.6
v1.13.5
v1.14.0-rc1
v1.15.0-dev
v1.13.4
v1.13.3
v1.13.2
v1.13.1
v1.13.0
v1.12.6
v1.13.0-rc2
v1.14.0-dev
v1.13.0-rc1
v1.12.5
v1.12.4
v1.12.3
v1.12.2
v1.12.1
v1.11.8
v1.12.0
v1.11.7
v1.12.0-rc2
v1.11.6
v1.12.0-rc1
v1.13.0-dev
v1.11.5
v1.11.4
v1.11.3
v1.10.6
v1.12.0-dev
v1.11.2
v1.10.5
v1.11.1
v1.10.4
v1.11.0
v1.11.0-rc2
v1.10.3
v1.11.0-rc1
v1.10.2
v1.10.1
v1.10.0
v1.9.6
v1.9.5
v1.10.0-rc2
v1.11.0-dev
v1.10.0-rc1
v1.9.4
v1.9.3
v1.9.2
v1.9.1
v1.9.0
v1.9.0-rc2
v1.10.0-dev
v1.9.0-rc1
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.8.0-rc3
v1.7.6
v1.8.0-rc2
v1.7.5
v1.8.0-rc1
v1.9.0-dev
v1.7.4
v1.7.3
v1.7.2
v1.7.1
v1.7.0
v1.7.0-rc3
v1.6.4
v1.7.0-rc2
v1.6.3
v1.7.0-rc1
v1.7.0-dev
v1.6.2
v1.6.1
v1.6.0
v1.6.0-rc2
v1.5.3
v1.6.0-rc1
v1.6.0-dev
v1.5.2
v1.5.1
v1.5.0
v1.5.0-rc2
v1.5.0-rc1
v1.5.0-dev
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.4.0-rc3
v1.4.0-rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#618
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sbrl on GitHub (Apr 6, 2017).
Gitea version 1.1.0+8-gd9bdf7a built with: bindata, sqlitegit version 2.7.4Ubuntu 16.04.2 LTS[x]):Description
If I create a new repository and then attempt to clone it, it doesn't let me. See the screenshot below.
Note that I've recently undergone a rather (painful) migration from gogs to gitea.
Screenshots
If this issue involves the Web Interface, please include a screenshot
@sbrl commented on GitHub (Apr 6, 2017):
Oh dear. Now I've tried pushing via https, and although git says "everything up to date" when I push a second time, it isn't showing up on the web interface.
Appropriate logs:
@lunny commented on GitHub (Apr 7, 2017):
For first issue, have you followed all the steps on https://docs.gitea.io/en-us/upgrade-from-gogs/
For second issue, please forget the old password on git config and try again.
@sbrl commented on GitHub (Apr 7, 2017):
@lunny Thanks for the reply. I have indeed followed all the steps in that guide (though your link results in a 404) - including rewriting the authorized_keys file multiple times by clicking the button in the admin panel.
Forget the old password in the git config? I'm not sure I understand. Do you mean on the server or the client? On the client-side I tried deleting and re-adding the ssh key, but that didn't help either :-(
@lunny commented on GitHub (Apr 7, 2017):
404 because docs site down.
I mean client-side. When using http, you could clear the old password git remember when you are using Gogs.
@sbrl commented on GitHub (Apr 7, 2017):
@lunny Hrm. The odd thing is that that was the first time I'd used http...... I'm just baffled as to why I can't clone via ssh :-/
@sbrl commented on GitHub (Apr 7, 2017):
Hrm. If I delete and recreate the repository on the server and preinitialise it with a README / .gitignore, then it lets me commit via https. ssh still doesn't work though :-(
@lunny commented on GitHub (Apr 8, 2017):
Have you set up the right user permission? all the files should be owned by your run user, for example
git.@sbrl commented on GitHub (Apr 8, 2017):
@lunny Good thinking. I've run a
sudo chown -R git:git /srv/git, but that doesn't seem to rectify the problem 😕@sbrl commented on GitHub (Apr 14, 2017):
Uh oh! Now I can't pull from an existing repository. I tried cycling the public key already. Suggestions? I can provide any information required on request.
@lunny commented on GitHub (Apr 14, 2017):
It seems your SSH public key is not exist. Commonly this means your
.authorized_keysfile is not corrected. And you have to runRewrite '.ssh/authorized_keys' fileonAdmin Panel. And could you runssh -T <git_user>@<gitea_host>and test if its normal?@sbrl commented on GitHub (Apr 14, 2017):
@lunny I have run the "Rewrite '.ssh/authorized_keys' file" thing multiple times, yet it still doesn't help.
ssh -T git@git.starbeamrainbowlabs.comjust hangs - I don't get any output :-(@lunny commented on GitHub (Apr 14, 2017):
Maybe you can use
ssh -vvv git@git.starbeamrainbowlabs.comto debug where is the problem.@sbrl commented on GitHub (Apr 14, 2017):
@lunny It doesn't mean much to me, but the output of that (up to the hang) is here: https://hastebin.com/bohoyirenu.txt
@sbrl commented on GitHub (Apr 14, 2017):
Right. This is getting a bit messy, so let me clear a few things up. This looks like 2 separate issues to me.
Can't clone a repository via ssh: Repository does not exist or you do not have accesswhen attempting to clone a newly-created repository.Invalid key ID[key-11]: public key does not exist [id: 11]when attempting to interact with an existing repository.@lunny commented on GitHub (Apr 15, 2017):
It seems your local key is a public key but not a private key? And the log is only a part not a full?
@sbrl commented on GitHub (Apr 15, 2017):
@lunny Nope, I have both a public and a private key locally, stored in
~/.ssh/sbrl_gogs.puband~/.ssh/sbrl_gogsrespectively. The log of thatssh -vvvcommand is indeed the full thing. It just hangs at the end of the log 😕@lunny commented on GitHub (Apr 15, 2017):
so did you have ~/.ssh/config to indicate the
sbrl_gogswhengit@git.starbeamrainbowlabs.com?@sbrl commented on GitHub (Apr 15, 2017):
@lunny Yep
@xxdesmus commented on GitHub (Apr 17, 2017):
Exact same problem.
Created a repo in the web UI, but when I try to clone it locally -- nada.
cloning via HTTPS works fine (but isn't ideal for obvious reasons). I can SSH to the server without issue -- and the PUB key loaded into my profile on Gitea is the same PUB key I am using locally.
UPDATE --
interestingly, the repo is set to be a public repo, and the SSH key is in place.
@sbrl commented on GitHub (Apr 20, 2017):
Ok.... so why does
pullwork andpushdoesn't?@lunny commented on GitHub (Apr 21, 2017):
How do you resolve your
pullissue?@sbrl commented on GitHub (Apr 21, 2017):
@lunny I have no idea. I've already tried cloning - and it didn't work. Then, just the other day, I forgot about which remote I needed to pull from (I've got both ssh and https set up until this issue is resolved), and it just worked. Astonished, I tried pushing too - but sadly that didn't work either.
@sbrl commented on GitHub (Apr 23, 2017):
Umm ok, I think pulling only works intermittently - not for a repositories.
@xxdesmus commented on GitHub (Apr 23, 2017):
I'll keep an eye on this, but Gitea is effectively broken as of right now, as best as I can tell.
@lunny commented on GitHub (Apr 24, 2017):
@xxdesmus what's the broken? could you post your error here or another issue?
@xxdesmus commented on GitHub (Apr 24, 2017):
@lunny please see above. Full details posted. Looks like you acknowledged it as a critical bug.
@xxdesmus commented on GitHub (Apr 24, 2017):
for what it's worth...here's a work around -- this issue seems to be specific to a user account that has admin privileges. I created a limited user named "git" and
git pullandgit pushwork just fine now.So my guess would be there's an issue in the code path related to an admin level user's permissions.
@kermorgant commented on GitHub (May 7, 2017):
I think I have the same issue, although not in the exact same scenario.
On my main machine, I can work with the repo from my admin account (just verified by cloning it to a temp folder).
But on the other machine where I have a separate ssh key (which I just added to gitea), I tried to pull the repo, and there, the issue happened.
@lunny commented on GitHub (May 7, 2017):
@sbrl are you running a Gitea builtin SSH server?
@xxdesmus Maybe your issue is not the same with this one since you have problem with a HTTPS remote.
@kermorgant Did you mean your issue is the same with @sbrl or @xxdesmus ?
@kermorgant commented on GitHub (May 8, 2017):
Hi @lunny
I'm trying with ssh, which I think is common to @sbrl and @xxdesmus (I understand that @xxdesmus uses https as a fallback option only to get it working).
@sbrl commented on GitHub (May 8, 2017):
@lunny Yep, I'm using the inbuilt server on port 22, as my actual ssh server is running on another port. This way I don't expose an ssh server with password-based authentication on port 22 to spammers (I do have a secure password - don't worry :P).
@sbrl commented on GitHub (Jun 27, 2017):
@lunny Any updates on this? Is there anything I can provide to expedite the tracking down of this bug?
@sbrl commented on GitHub (Aug 5, 2017):
I've just tried crerating a non-admin account as @xxdesmus suggested and adding a new ssh key to it, but that still doesn't work - I get the exact same response. Why is it always me who experiences the difficult problems :P
I'm using 4096-bit RSA keys, if that helps.
@IDobrelya commented on GitHub (Aug 8, 2017):
Yesterday I had similar issue. After setup server, I changed port to connect, and left only port 14222. But git tried pull using port 22, so this port was closed, git returned similar error: "fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists."
Please check file /etc/ssh/ssh_config, maybe you also have open only one port, which different from 22.
@sbrl commented on GitHub (Aug 8, 2017):
@IDobrelya I have port, say, 4567 which runs my main SSH server that I use to access the server. I then have Gitea running on 22 with the inbuilt SSH server. I have verified that public key authentication succeeds with
ssh user@host -vvv. That can't be problem. In addition, everything works as intended with gogs, the project that gitea was forked from.@sbrl commented on GitHub (Oct 15, 2017):
Hello again, @lunny! I've just updated to Gitea 1.2.0, and I've got an update for you - the error message has changed! Here's the new message:
@builderall commented on GitHub (Oct 28, 2017):
I can use ssh with below setup. Gitea Version:
5f4210aI'm using it on docker (port is mapped to 10022->22). Have ssh config file on client side as follows
Host hostname
Port 10022
IdentityFile ~/.ssh/id_rsa
Also make sure the permission on file is 600 if it is on linux. Hope this helps.
Thanks
@sbrl commented on GitHub (Oct 28, 2017):
@builderall Nope, sorry! That doesn't help really. I'm not currently using docker though. I've checked the permissions on all files involved like a million times 😕
@sbrl commented on GitHub (Dec 11, 2017):
Ok, I've updated to giteaa v1.3.1, @lunny - here's what it says now:
.....and then in
gitea.log:....and then in
serv.log:``
2017/12/11 11:52:44 [...io/gitea/cmd/serv.go:174 runServ()] [F] Failed to get repository: no such column: size
@lafriks commented on GitHub (Dec 11, 2017):
Migrations seems not to be run correctly... As repository seems to be missing size column
@sbrl commented on GitHub (Dec 11, 2017):
@lafriks Is that something I can run again manually? Or should I just create a
sizecolumn as anintin therepositorytable indata/gogs.db?@sbrl commented on GitHub (Dec 11, 2017):
Update: Yeah, I've got the size column issue fixed, so now I'm getting the old
error again. Here's the logging output: https://hastebin.com/idalidemov
@lunny commented on GitHub (Dec 11, 2017):
could you find the ssh key on table public_key where id=12?
@sbrl commented on GitHub (Dec 11, 2017):
@lunny Apparently it doesn't exist!
@monofon commented on GitHub (Mar 22, 2018):
I just ran into this same problem with a clean install of Gitea 1.4.0-rc2 on a fully patched Ubuntu 16.04.4 LTS. SSH access to a brand new repository does not work with the following message:
SSH access to the machine with
ssh -T git@...works fine and reports:I was previously running a Gogs instance, where everything worked with this particular SSH key and about 100 others.
@monofon commented on GitHub (Mar 22, 2018):
Funny. I made it work. Here is what happened:
Database configuration is at default settings:
Start Gitea like this:
Database is created in
/home/git/gitea/data/gitea.db.Try SSH access to a newly created repo, get the error above. Because the error says:
Check
/home/git/gitea/data/gitea.dbmanually. The file exists, but is empty!Find the actual database in
/home/git/data/gitea.db.Change the database configuration to use an absolute path:
Move the database from
/home/git/data/gitea.dbto/home/git/gitea/data/gitea.db.Everything works fine.
There seems to confusion as to how to interpret a relative database path. Mostly it seems to be used relative to the current directory, but sometimes relative to the location of the
giteaexecutable.@sbrl commented on GitHub (Mar 24, 2018):
Hrm. I've got a slightly different error, @monofon:
Thoughts?
@lunny commented on GitHub (Mar 25, 2018):
@sbrl regenerated sshkeys on the admin panel
@sbrl commented on GitHub (Mar 25, 2018):
From the admin panel:
I'm using the inbuilt SSH server, @lunny - so I shouldn't need to?
@lunny commented on GitHub (Mar 25, 2018):
@sbrl yes. maybe your public key has been deleted?
@sbrl commented on GitHub (Mar 25, 2018):
@lunny Nope, it's still there and doesn't work - even after deleting and readding.
@sbrl commented on GitHub (Mar 25, 2018):
Doing
ssh -T git@starbeamrainbowlabs.com(to access the ssh main server) gives this:....but
ssh -T git@git.starbeamrainbowlabs.com(the internal Gitea SSH server) gives nothing, and doesn't return.@sbrl commented on GitHub (Mar 25, 2018):
......but as soon as I try to push via
starbeamrainbowlabs.com(the main ssh server), I get this again:How come it can authenticate via
-T, but not when pushing?@lafriks commented on GitHub (Mar 26, 2018):
Regenerate ssh authorized keys file using admin section in web UI and try again
@sbrl commented on GitHub (Mar 27, 2018):
@lafriks As I explained above, it says that it will have no effect if I'm using the inbuilt SSH server - which I am. Regardless, I've done do anyway - and it has not helped. I'm still getting this message:
@sbrl commented on GitHub (Jun 4, 2018):
Hey! What's the status on this, @lunny and @lafriks? Is there any additional information or data I can provide? I can provide a complete database copy for example if required to track down this issue.
To summarise:
opensshand the inbuilt SSH server setupssh -T git@starbeamrainbowlabs.com->Hi there, You've successfully authenticated, but Gitea does not provide shell access.ssh -T git@git.starbeamrainbowlabs.com): https://hastebin.com/saheluriqaInvalid key ID[key-15]: public key does not exist [id: 15]
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.`
Additional logs - pushing via inbuilt server (no output when pushing via openssh)
logs/gitea.loglogs/xorm.log@techknowlogick commented on GitHub (Jun 4, 2018):
@sbrl are you still using the same version of Gitea?
@sbrl commented on GitHub (Jun 4, 2018):
@techknowlogick I'm currently on v1.4.1 of Gitea, on Ubuntu Server 16.04 LTS.
@adrinux commented on GitHub (Jun 12, 2018):
Also seeing this issue using system ssh server (built in disabled). Can clone via http but not ssh. ssh logs indicate gitea user authenticates successfully but git reports:
As for others. Cycling the authorized_keys file in the admin section makes no difference (backup is identical). authorized_keys points to correct binary and app.ini. The authorized_key listed is the one I uploaded to my user account.
Here's debug output from ssh -T -vvv gitea@my.gitea.server
Hope this helps.
@adrinux commented on GitHub (Jun 13, 2018):
Solved!
I'm using a 'gitea' user to run gitea. It seems I'd created the gitea user with shell /bin/false instead of bash.
You can check your gitea user (wehter that be git or gitea or whatever) in /etc/passwd
Change the gitea users shell with:
Once I'd done that cloning via ssh worked. It seems the gitea user needs shell access if you're using the system SSH server.
@sbrl commented on GitHub (Jun 13, 2018):
@adrinux That's odd. I've done the same, and it has not solved the issue for me - either via openssh or the builtin ssh server 😕
If at all possible, I'd like to avoid giving the git user a shell.
@adrinux commented on GitHub (Jun 14, 2018):
@sbrl It actually mentions making sure you've given the git user a shell in the Gitea troubleshooting section (wish I'd read that earlier).
I have no idea how Gitea is built - but at the very least it has to interact with git to do its work, so it would have to shell out at some point. Seems unavoidable to me.
@sbrl commented on GitHub (Jun 15, 2018):
Hrm, I see @adrinux. On my server, I have the
giteabinary started as thegituser, and I executesetcap 'cap_net_bind_service=+ep' giteato ensure it can bind to port 22 without being root. Surely it's theoretically possible to set the 'shell' of the git user to be thegiteabinary? Wouldn't that be in theory more secure?If I grant shell access to the
gituser permanently (instead of just for testing), who else would be able to gain access to my server? Would that be anyone with an ssh key attached to their account?If that is a thing I need to do, I'd like to at least figure out how to jail that user to
/srv/git(the directory in which all git-related stuff happens, and also thegituser's home directory).Also, there's still the issue surrounding the built-in ssh server.
To that end, I've no idea why that's not workingI've just been inspecting the logs again, and I found some possible clues. Here's a teensy extract:
Hrm, curious. I'm sure I pulled from
git@git.starbeamrainbowlabs.com:sbrl/FloatingIslands.git, and my repository on disk issbrl/floatingislands.git....? Here's all the log lines generated for this attempt:If there's anything else I can do to help speed up the process of fixing it, I'm happy to do so. This has been driving me nuts for far too long :P
(Supervised, of course) shell access to my server is not out of the question either if it helps. The only reason I haven't turned gitea inside-out to fix this issue already is that I don't know Go, and that the go toolchain is way too big for my hard drive.
@adrinux commented on GitHub (Jun 15, 2018):
I have no idea how Gitea actually works I'm just assuming that when gitea wants to do git operations it calls git - otherwise Gitea would have to replicate git functionality in itself, no?
As for you other problems. Are you sure you don't have mis-configured paths in the gitea config? I had an issue with certs yesterday where gitea needed the full path specified in its conifg, not a path relative to gitea home. Or permissions issues on the filesystem?
@sbrl commented on GitHub (Jun 15, 2018):
....but you can start a subprocess (e.g.
git) with arguments without starting a shell.I'm pretty sure, yeah. I did another
sudo chown -R git:git /srv/git && sudo chmod -R u+rw /srv/gitjust in case, but it all seems to be fine. Here's my gitea config file (screenshot of admin page)@adrinux commented on GitHub (Jun 15, 2018):
I bow to your greater Unix knowledge - I've a feeling your git user doesn't need a shell if you use the built in ssh, only if you're using system openssh...but again, I don't know how it actually works...
Maybe it's worth looking at the config cheat sheet and trying some other options for the ini file, SSH_ROOT_PATH for instance. Though it sounds like you've probably checked all that.
My only other thought it to check you're not overriding some of the ini declarations at run time in the systemd service (or whatever you're using to start Gitea).
I have two instances running now, many other people happily use Gitea, so it really does seem like there is something awry in your setup , hope you figure out what that is.
@lunny commented on GitHub (Jun 15, 2018):
Is the repo
sbrl/floatingislandsin your databaserepository? And another issue is sqlite will be failed when some processes visit it.@sbrl commented on GitHub (Jun 17, 2018):
@lunny Thanks thanks for the suggestion there. It just keeps getting weirder. If I download a copy of
gogs.dband inspect it, I see less than half of my repositories in that table!Running
stat /srv/git/gitea/data/gogs.dbgives me these values:What's more, it doesn't seem to have saved any changes to my keys to
gogs.db- further inspection ofgogs.dbreveals that the public key saved in the database is different to the one I have locally - even after deleting it and recreating it.Furthermore, if I try and upload a GPG key, it wipes it shortly afterwards - as if I'd never entered it.
@sbrl commented on GitHub (Jun 17, 2018):
Thanks @adrinux for the link there, I hadn't actually seen that. I can't see anything wrong with my config file though.
Here's my configuration (with the
[security]section stripped):By all accounts, it looks like gitea is silently failing to write to the database, but there's no logging output there to know either way, though that modify time is rather telling. Checking the permissions on
data/gogs.dbreveals that it's owned bygit:gitand set to-rw-r--r--, so I'm not sure that's the issue.@lunny commented on GitHub (Jun 19, 2018):
@sbrl maybe you can find the
xorm.log.@sbrl commented on GitHub (Jun 20, 2018):
@lunny Absolutely. Here's a transcript from
xorm.log: https://hastebin.com/nisusumiko.sqlHere's what I did in that transcript:
sbrl/FloatingIslands(which worked)sbrl/FloatingIslands(which failed)sbrl/cscz(which worked)sbrl/cscz(which failed)More is available upon request of course 😺
@lunny commented on GitHub (Jun 21, 2018):
@sbrl that's a blank URL.
@sbrl commented on GitHub (Jun 21, 2018):
@lunny Huh, that's weird. It shows for me! Here it is again using pastebin.com instead: https://pastebin.com/WdNmNpJ4
If this doesn't work, then I'll paste it directly into a message here - but be warned: it'll be very long :P
@noerw commented on GitHub (Jun 28, 2018):
At the risk of adding more confusion to this long issue:
I had this issue as well using a default ssh install.
I was unable to to clone
sshUser@domain:giteaUser/repo.git.What worked instead is
sshUser@domain:~/pathToGiteaRepos/giteaUser/repo.git.I then "fixed" the issue by clicking "Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)." in the admin panel of gitea. ssh clones with the advertised URL worked then.
Hoewever, #2046 happened then, so beware.
@sbrl commented on GitHub (Jun 29, 2018):
@noerw Ah, interesting. I'm not sure that issue is related to this one though, as to summarise (this issue does have quite the history :P), we've just discovered that, for some reason, my install is not writing to the database at all! i.e. half of my repositories are missing from the database, and my ssh keys in the database that are used for 2nd-stage authentication are not updating either.
I'd recommend opening another issue for that, as I suspect that it has another root cause.
Also, ping @lunny. Does that pastebin link for you?
@lunny commented on GitHub (Jul 6, 2018):
@sbrl maybe because you enabled 2fa? Could you try without 2fa enabled? Cannot find any useful clues from your pastebin.
@sbrl commented on GitHub (Jul 8, 2018):
Nope, I haven't got 2-factor authentication enabled @lunny.
I've done an
ls -lARof my /srv/git/gitea folder, in case that brings any permissions issues to light. I think I've got everything setup right, but just to be sure. You can download the gzipped output here: https://transfer.sh/113OEV/gitea-ls.txt.gzI'm also open to running a 'custom' build of gitea with extra logging output enabled - though I don't currently have the ability to compile go programs - if that would help too.
@leepfrog-ger commented on GitHub (Jul 9, 2018):
Having the same issue running 1.4.2 on Windows with MSSQL backend and using the builtin SSH server.Pulling public repos works, pulling private repos or pushing to public and private repos fails with the errors below.Running the SQL query against the database indeed returns the correct entry from the public_key table (so the key was correctly saved)./edit: Just noticed that in my case it was due to another issue (LDAP users being disabled by Sync)
@sbrl commented on GitHub (Aug 31, 2018):
Yes! I've finally fixed it. Turns out that I've I had a strange bug in my systemd configuration file whereby I gave it the old working directory during the migration. Updating that and cleaning up seems to have fixed the strange DB issues, so it all works as expected now :D :D :D
Thanks for all your help, @lunny 😺
@kratzercanby commented on GitHub (Nov 20, 2018):
TL;DR: I manually typed in my url to
git remote set-url origin <urlhere>, instead of copying from the hosting website, and it fixed my permission denied issue. Probably not an issue the OP faced, but thought I should post it here anyway since this is the best-matching issue on the internet I could find in the last 5 hours I've spent searching.For others experiencing similar issues, I wanted to post something that solved my issue that was almost identical to this main thread but seems to have different source (i.e., all git -v and git -T commands were returning successful authentication, and my SSH keys were properly setup). And I was getting "Permission denied (publickey)." on trying to push or clone my repository.
It turns out there must have been some strange whitespace character in my git url, because after typing in the url manually, I was able to clone and push successfully. I had been copying the clone url directly from GitHub, and reset the url using
git remote set-url origin <urlhere>multiple times, but always copying directly from the website. You can see from mygit config -lafter my failed attempt, the url looks identical to the one that I changed it to. Yet, I can't seem to reproduce the problem. I have since tried to go back andgit remote set-url origin <url-directly-from-GitHub>again, yet pushing still works. That is the only command I ran that changed anything between my last fail and my first success. And on visual inspection, I see no differences between the output ofgit config -lbefore and after the fix. So I suspect either a whitespace/carriage return issue, or something else that I don't understand that changed by me manually typing in my url.Below you can see that my url before and what I changed it to look identical. If git captured revisions of the config file (maybe it does?), I would revert to the old version to find the issue.

@tanchekwei commented on GitHub (Sep 24, 2019):
@kratzercanby Thank you so much for saving me A LOT of time. I have been trying to solve the problem for hours. Cheer~
@sbrl commented on GitHub (Sep 25, 2019):
To an extent, I think the title of this issue is somewhat deceptive, since my specific issue was specifically related to a migration from Gogs to Gitea.
I guess a single error message can have a number of different root causes.