# Authentication error connecting the first time per session, but subsequent attempts work fine

**URL:** <https://forum.gitea.com/t/authentication-error-connecting-the-first-time-per-session-but-subsequent-attempts-work-fine/12049>\
**Category:** General\
**Created:** [April 17, 2026, 11:15pm UTC](https://forum.gitea.com/t/authentication-error-connecting-the-first-time-per-session-but-subsequent-attempts-work-fine/12049 "2026-04-17T23:15:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joebananas10](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@joebananas10](https://forum.gitea.com/u/joebananas10)\
**Post date:** [April 17, 2026, 11:15pm UTC](https://forum.gitea.com/t/authentication-error-connecting-the-first-time-per-session-but-subsequent-attempts-work-fine/12049/1 "2026-04-17T23:15:00Z")

</div>

I have 1.25.5 running on a Windows Server 2022 VM. Authentication is with Active Directory, type is LDAP (via BindDN). Whenever a user tries to push or pull from the client to the server, the first time in a session always fails with an authentication error, but subsequent attempts succeed. this has been an issues since i first setup the Gitea server with version 1.16.7 back in 2022. It happens when attempting the action in Visual Studio 2026, Visual Studio Code, and command line. Here are Access and Router logs of recent attempts.

192.0.2.10 - - [17/Apr/2026:15:55:18 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-receive-pack HTTP/1.1” 401 13 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:55:18 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-receive-pack HTTP/1.1” 401 28 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:55:18 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-receive-pack HTTP/1.1” 401 28 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:56:16 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-receive-pack HTTP/1.1” 401 13 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:56:17 -0700] “POST /login/oauth/access\_token HTTP/1.1” 200 1795 “” “Git-Credential-Manager/2.7.3.0 (Windows; x86-64) CLR/.NET Framework 4.8.9325.0”  
192.0.2.10 - 132399 [17/Apr/2026:15:56:17 -0700] “GET /orgname/myproject.git/info/refs?service=git-receive-pack HTTP/1.1” 200 489 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:56:44 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-upload-pack HTTP/1.1” 401 13 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - 132399 [17/Apr/2026:15:56:44 -0700] “GET /orgname/myproject.git/info/refs?service=git-upload-pack HTTP/1.1” 200 190 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - 132399 [17/Apr/2026:15:56:46 -0700] “POST /orgname/myproject.git/git-upload-pack HTTP/1.1” 200 387 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - 132399 [17/Apr/2026:15:56:46 -0700] “POST /orgname/myproject.git/git-upload-pack HTTP/1.1” 200 11998 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - - [17/Apr/2026:15:57:12 -0700] “GET /OrgName/MyProject.git/info/refs?service=git-receive-pack HTTP/1.1” 401 13 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
192.0.2.10 - 132399 [17/Apr/2026:15:57:12 -0700] “GET /orgname/myproject.git/info/refs?service=git-receive-pack HTTP/1.1” 200 489 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”  
127.0.0.1 - - [17/Apr/2026:15:57:15 -0700] “POST /api/internal/hook/pre-receive/OrgName/MyProject HTTP/1.1” 200 2 “” “GiteaHttpLib”  
127.0.0.1 - - [17/Apr/2026:15:57:20 -0700] “POST /api/internal/hook/post-receive/OrgName/MyProject HTTP/1.1” 200 98 “” “GiteaHttpLib”  
192.0.2.10 - 132399 [17/Apr/2026:15:57:15 -0700] “POST /orgname/myproject.git/git-receive-pack HTTP/1.1” 200 113 “” “git/2.53.0 (Microsoft Windows NT 10.0.26200.0; Win32NT x64) CLR/4.0.30319 VS18/18.0.0”

2026/04/17 15:55:18 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922  
2026/04/17 15:55:18 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922, 401 Unauthorized in 1.6ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:55:18 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922  
2026/04/17 15:55:18 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922, 401 Unauthorized in 146.5ms @ web/web.go:118(web.Routes.webAuth)  
2026/04/17 15:55:18 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922  
2026/04/17 15:55:19 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:49922, 401 Unauthorized in 140.9ms @ web/web.go:118(web.Routes.webAuth)  
2026/04/17 15:56:16 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59455  
2026/04/17 15:56:16 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59455, 401 Unauthorized in 1.1ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:56:17 HTTPRequest [T] router: started POST /login/oauth/access\_token for 192.0.2.10:59456  
2026/04/17 15:56:17 HTTPRequest [I] router: completed POST /login/oauth/access\_token for 192.0.2.10:59456, 200 OK in 28.8ms @ auth/oauth2\_provider.go:461(auth.AccessTokenOAuth)  
2026/04/17 15:56:17 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59455  
2026/04/17 15:56:17 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59455, 200 OK in 63.8ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:56:44 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-upload-pack for 192.0.2.10:59468  
2026/04/17 15:56:44 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-upload-pack for 192.0.2.10:59468, 401 Unauthorized in 1.6ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:56:44 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-upload-pack for 192.0.2.10:59468  
2026/04/17 15:56:44 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-upload-pack for 192.0.2.10:59468, 200 OK in 68.2ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:56:46 HTTPRequest [T] router: started POST /OrgName/MyProject.git/git-upload-pack for 192.0.2.10:59468  
2026/04/17 15:56:46 HTTPRequest [I] router: completed POST /OrgName/MyProject.git/git-upload-pack for 192.0.2.10:59468, 200 OK in 64.7ms @ repo/githttp.go:477(repo.ServiceUploadPack)  
2026/04/17 15:56:46 HTTPRequest [T] router: started POST /OrgName/MyProject.git/git-upload-pack for 192.0.2.10:59468  
2026/04/17 15:56:47 HTTPRequest [I] router: completed POST /OrgName/MyProject.git/git-upload-pack for 192.0.2.10:59468, 200 OK in 108.8ms @ repo/githttp.go:477(repo.ServiceUploadPack)  
2026/04/17 15:57:12 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59579  
2026/04/17 15:57:12 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59579, 401 Unauthorized in 1.1ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:57:12 HTTPRequest [T] router: started GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59579  
2026/04/17 15:57:12 HTTPRequest [I] router: completed GET /OrgName/MyProject.git/info/refs?service=git-receive-pack for 192.0.2.10:59579, 200 OK in 64.2ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:57:15 HTTPRequest [T] router: started POST /OrgName/MyProject.git/git-receive-pack for 192.0.2.10:59579  
2026/04/17 15:57:15 HTTPRequest [T] router: started POST /api/internal/hook/pre-receive/OrgName/MyProject for 127.0.0.1:0  
2026/04/17 15:57:15 HTTPRequest [I] router: completed POST /api/internal/hook/pre-receive/OrgName/MyProject for 127.0.0.1:0, 200 OK in 2.7ms @ private/hook\_pre\_receive.go:107(private.HookPreReceive)  
2026/04/17 15:57:18 HTTPRequest [W] router: slow POST /OrgName/MyProject.git/git-receive-pack for 192.0.2.10:59579, elapsed 3766.4ms @ repo/githttp.go:482(repo.ServiceReceivePack)  
2026/04/17 15:57:20 HTTPRequest [T] router: started POST /api/internal/hook/post-receive/OrgName/MyProject for 127.0.0.1:0  
2026/04/17 15:57:20 HTTPRequest [I] router: completed POST /api/internal/hook/post-receive/OrgName/MyProject for 127.0.0.1:0, 200 OK in 179.1ms @ private/hook\_post\_receive.go:33(private.HookPostReceive)  
2026/04/17 15:57:20 HTTPRequest [I] router: completed POST /OrgName/MyProject.git/git-receive-pack for 192.0.2.10:59579, 200 OK in 5355.7ms @ repo/githttp.go:482(repo.ServiceReceivePack)  
2026/04/17 15:59:00 HTTPRequest [T] router: started GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093  
2026/04/17 15:59:00 HTTPRequest [I] router: completed GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093, 401 Unauthorized in 1.1ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:59:00 HTTPRequest [T] router: started GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093  
2026/04/17 15:59:00 HTTPRequest [I] router: completed GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093, 401 Unauthorized in 159.0ms @ web/web.go:118(web.Routes.webAuth)  
2026/04/17 15:59:00 HTTPRequest [T] router: started GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093  
2026/04/17 15:59:01 HTTPRequest [I] router: completed GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60093, 401 Unauthorized in 129.7ms @ web/web.go:118(web.Routes.webAuth)  
2026/04/17 15:59:03 HTTPRequest [T] router: started GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60099  
2026/04/17 15:59:03 HTTPRequest [I] router: completed GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60099, 401 Unauthorized in 1.1ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:59:04 HTTPRequest [T] router: started POST /login/oauth/access\_token for 192.0.2.11:60100  
2026/04/17 15:59:04 HTTPRequest [I] router: completed POST /login/oauth/access\_token for 192.0.2.11:60100, 200 OK in 28.0ms @ auth/oauth2\_provider.go:461(auth.AccessTokenOAuth)  
2026/04/17 15:59:04 HTTPRequest [T] router: started GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60099  
2026/04/17 15:59:04 HTTPRequest [I] router: completed GET /OrgName/MyProject2.git/info/refs?service=git-receive-pack for 192.0.2.11:60099, 200 OK in 69.3ms @ repo/githttp.go:503(repo.GetInfoRefs)  
2026/04/17 15:59:05 HTTPRequest [T] router: started POST /OrgName/MyProject2.git/git-receive-pack for 192.0.2.11:60099  
2026/04/17 15:59:06 HTTPRequest [T] router: started POST /api/internal/hook/pre-receive/OrgName/MyProject2 for 127.0.0.1:0  
2026/04/17 15:59:06 HTTPRequest [I] router: completed POST /api/internal/hook/pre-receive/OrgName/MyProject2 for 127.0.0.1:0, 200 OK in 3.2ms @ private/hook\_pre\_receive.go:107(private.HookPreReceive)  
2026/04/17 15:59:08 HTTPRequest [W] router: slow POST /OrgName/MyProject2.git/git-receive-pack for 192.0.2.11:60099, elapsed 3294.8ms @ repo/githttp.go:482(repo.ServiceReceivePack)  
2026/04/17 15:59:08 HTTPRequest [T] router: started POST /api/internal/hook/post-receive/OrgName/MyProject2 for 127.0.0.1:0  
2026/04/17 15:59:09 HTTPRequest [I] router: completed POST /api/internal/hook/post-receive/OrgName/MyProject2 for 127.0.0.1:0, 200 OK in 184.9ms @ private/hook\_post\_receive.go:33(private.HookPostReceive)  
2026/04/17 15:59:09 HTTPRequest [I] router: completed POST /OrgName/MyProject2.git/git-receive-pack for 192.0.2.11:60099, 200 OK in 3727.7ms @ repo/githttp.go:482(repo.ServiceReceivePack)  
2026/04/17 15:59:55 HTTPRequest [T] router: started GET /OrgName/MyProject2/src/branch/branch-name/MyProject2/wwwroot/css/reportinglibrary.css for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [I] router: completed GET /OrgName/MyProject2/src/branch/branch-name/MyProject2/wwwroot/css/reportinglibrary.css for 192.0.2.11:56554, 200 OK in 632.0ms @ repo/view\_home.go:359(repo.Home)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/css/index.css?v=1.25.5 for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/css/index.css?v=1.25.5 for 192.0.2.11:56554, 304 Not Modified in 0.5ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/css/theme-gitea-auto.css?v=1.25.5 for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/js/index.js?v=1.25.5 for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/js/index.js?v=1.25.5 for 192.0.2.11:56554, 304 Not Modified in 0.0ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/css/theme-gitea-auto.css?v=1.25.5 for 192.0.2.11:56554, 304 Not Modified in 0.0ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/img/logo.svg for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/img/logo.svg for 192.0.2.11:56554, 304 Not Modified in 0.0ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /avatar/dba0a99d976c421edcc603dde1e875b7?size=48 for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/css/index-domready.3e022997.css for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/css/index-domready.3e022997.css for 192.0.2.11:56554, 304 Not Modified in 0.0ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/js/index-domready.a9e3e9a4.js for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/js/index-domready.a9e3e9a4.js for 192.0.2.11:56554, 304 Not Modified in 0.6ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:56 HTTPRequest [I] router: completed GET /avatar/dba0a99d976c421edcc603dde1e875b7?size=48 for 192.0.2.11:56554, 303 See Other in 50.6ms @ user/avatar.go:38(user.AvatarByEmailHash)  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /OrgName/MyProject2/tree-view/branch/branch-name/?sub\_path=MyProject2%2Fwwwroot%2Fcss%2Freportinglibrary.css for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: started GET /assets/img/favicon.png for 192.0.2.11:56554  
2026/04/17 15:59:56 HTTPRequest [T] router: completed GET /assets/img/favicon.png for 192.0.2.11:56554, 304 Not Modified in 0.0ms @ public/public.go:34(web.Routes.FileHandlerFunc)  
2026/04/17 15:59:57 HTTPRequest [I] router: completed GET /OrgName/MyProject2/tree-view/branch/branch-name/?sub\_path=MyProject2%2Fwwwroot%2Fcss%2Freportinglibrary.css for 192.0.2.11:56554, 200 OK in 387.4ms @ repo/treelist.go:145(repo.TreeViewNodes)
