Gitlab push/pull using personal access token failed
Summary
In our gitlab instance we're using Personal Access Tokens push, pull etc. After some time our tokens are declined by git (but still works with API)
Steps to reproduce
Just use token with git client for some time. Then the token is declined in git command but works with API.
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
What is the current bug behavior?
`user@user:~/git_comarch$ git clone https://gitlab:rz_LAwR18Gf4RDN2_yti@git.local/bu169006/plc169003/EnvironmentsCZK.git
Cloning into 'EnvironmentsCZK'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab:rz_LAwR18Gf4RDN2_yti@git.local/bu169006/plc169003/EnvironmentsCZK.git/'`
What is the expected correct behavior?
Git clone works
Relevant logs and/or screenshots
From production log: When the git command failed:
`Completed 302 Found in 13ms (ActiveRecord: 0.0ms)
Started GET "/bu169006/plc169003/EnvironmentsCZK.git/info/refs?service=git-upload-pack" for 10.40.6.16 at 2019-07-29 16:36:45 +0200
Processing by Projects::GitHttpController#info_refs as /
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"bu169006/plc169003", "project_id"=>"EnvironmentsCZK.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 34ms (Views: 1.2ms | ActiveRecord: 6.9ms)
Started GET "/bu169006/plc169003/EnvironmentsCZK.git/info/refs?service=git-upload-pack" for 10.40.6.16 at 2019-07-29 16:36:45 +0200
Processing by Projects::GitHttpController#info_refs as /
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"bu169006/plc169003", "project_id"=>"EnvironmentsCZK.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 55ms (Views: 1.2ms | ActiveRecord: 16.7ms)`
When we create new token:
`Started GET "/bu169006/plc169003/EnvironmentsCZK.git/info/refs?service=git-upload-pack" for 10.40.6.18 at 2019-07-29 17:32:59 +0200
Processing by Projects::GitHttpController#info_refs as /
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"bu169006/plc169003", "project_id"=>"EnvironmentsCZK.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 40ms (Views: 1.9ms | ActiveRecord: 7.3ms)
Started GET "/bu169006/plc169003/EnvironmentsCZK.git/info/refs?service=git-upload-pack" for 10.40.6.18 at 2019-07-29 17:32:59 +0200
Processing by Projects::GitHttpController#info_refs as /
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"bu169006/plc169003", "project_id"=>"EnvironmentsCZK.git"}
Completed 200 OK in 96ms (Views: 1.1ms | ActiveRecord: 21.6ms)
Started POST "/bu169006/plc169003/EnvironmentsCZK.git/git-upload-pack" for 10.40.6.18 at 2019-07-29 17:32:59 +0200
Processing by Projects::GitHttpController#git_upload_pack as
Parameters: {"namespace_id"=>"bu169006/plc169003", "project_id"=>"EnvironmentsCZK.git"}
Completed 200 OK in 124ms (Views: 1.3ms | ActiveRecord: 21.4ms)`
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.5.3p105
Gem Version: 2.7.9
Bundler Version:1.17.3
Rake Version: 12.3.2
Redis Version: 3.2.12
Git Version: 2.21.0
Sidekiq Version:5.2.7
Go Version: unknown
GitLab information
Version: 11.11.3
Revision: e3eeb779d72
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 9.6.13
URL: https://git.local
HTTP Clone URL: https://git.local/some-group/some-project.git
SSH Clone URL: git@git.local:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: oauth2_generic
GitLab Shell
Version: 9.1.0
Repository storage paths:
- default: /opt/gitvolume/gitlab-data/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git`
Results of GitLab application Check
`Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 9.1.0 ? ... OK (9.1.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes`
`Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
2/1 ... yes
1/2 ... yes
5/4 ... yes
6/5 ... yes
6/6 ... yes
6/7 ... yes
6/8 ... yes
2/41 ... yes
2/42 ... yes
41/43 ... yes
41/44 ... yes
41/45 ... yes
41/46 ... yes
41/47 ... yes
41/48 ... yes
41/49 ... yes
58/51 ... yes
79/53 ... yes
43/54 ... yes
76/57 ... yes
86/59 ... yes
41/60 ... yes
95/61 ... yes
95/62 ... yes
98/64 ... yes
76/65 ... yes
43/66 ... yes
105/67 ... yes
105/68 ... yes
105/69 ... yes
105/70 ... yes
43/71 ... yes
113/72 ... yes
81/73 ... yes
2/74 ... yes
121/75 ... yes
121/76 ... yes
124/77 ... yes
43/78 ... yes
43/79 ... yes
43/80 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.5.3)
Git version >= 2.21.0 ? ... yes (2.21.0)
Git user has default SSH configuration? ... yes
Active users: ... 61
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)