#39288·gitea

`401 Unauthorized` after switching user

Author: liigoCreated Sep 10, 2026Updated Sep 28, 2026
Labelsissue/not-a-bug

Gitea Version

1.27.3

What happened?

Steps to reproduce:

  • Step 1, sign in user1 (guest), and create a private repo (repo1) in web ui.
  • Step 2, git clone repo1 by http url: http://172.17.200.11:3000/guest/repo1.git, successed after GCM authorize (it runs automatically).Image
  • Step 3, sign out user1 (guest), and sign in user2 (guest2), and create user2's private repo (repo2) in web ui.
  • Step 4, git clone repo2: http://172.17.200.11:3000/guest2/repo2.git, FAILED with error remote: Repository not found:
bash
git.exe clone --progress -v -- "http://172.17.200.11:3000/guest2/repo2.git" "D:/tmp/repo2"
Cloning into 'D:/tmp/repo2'...
remote: Repository not found
fatal: repository 'http://172.17.200.11:3000/guest2/repo2.git/' not found

git did not exit cleanly (exit code 128) (1250 ms @ 2026/9/10 16:08:52)

Gitea server-side reports error with 401 Unauthorized and 404 Not Found:

2026/09/10 16:08:49 HTTPRequest [I] router: completed GET /guest2/repo2.git/info/refs?service=git-upload-pack for 10.100.197.57:50479, 401 Unauthorized in 4.0ms @ repo/githttp.go:455(repo.GetInfoRefs)
2026/09/10 16:08:50 HTTPRequest [I] router: completed GET /guest2/repo2.git/info/refs?service=git-upload-pack for 10.100.197.57:50479, 404 Not Found in 5.1ms @ repo/githttp.go:455(repo.GetInfoRefs)

What I expect

When cloning repo2, it should just works. The 'GCM authorize' step should have been re-run for user2 (the active user at that time) automatically.

How are you running Gitea?

binary, windows 10, sqlite3.

app.ini

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
WORK_PATH = D:\Gitea
RUN_MODE = prod

[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = 
SCHEMA = 
SSL_MODE = disable
PATH = D:\Gitea\data\gitea.db
LOG_SQL = false

[repository]
ROOT = D:/Gitea/data/repos
ENABLE_PUSH_CREATE_USER = true
ENABLE_PUSH_CREATE_ORG = true

[server]
SSH_DOMAIN = 172.17.200.11
DOMAIN = 172.17.200.11
HTTP_PORT = 3000
ROOT_URL = http://172.17.200.11:3000/
APP_DATA_PATH = D:\Gitea\data
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = RFZr1A0Oj02BO3VGt4Zes9JA03FIkeg3mkhWhPccyow

[lfs]
PATH = D:/Gitea/data/lfs

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[cron.update_checker]
ENABLED = false

[session]
PROVIDER = file

[log]
MODE = console
LEVEL = info
ROOT_PATH = D:/Gitea/log

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

[security]
INSTALL_LOCK = true
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3ODc5MDc3NjV9.3Rjq89x7uadkYnD4-GEWNUO7HpZovAxU3RBuGgUD-LU
PASSWORD_HASH_ALGO = pbkdf2

[oauth2]
JWT_SECRET = gG0NMLEuqdDXUiaqqboqjHaKPgiLfO4tohTmfJYZuoc