Error creating repository: Unauthorized (HTTP 401)

Hello,
i would like to create a repository for a new project created with rails but i had this error :

Error creating repository: Unauthorized (HTTP 401)
Bad credentials. The API can’t be accessed using username/password authentication. Please create a personal access token to access this endpoint: http://github.com/settings/tokens

i followed the instruction in this link by creating a token which permit to repo, admin : repo hook and delete a repo

but finally, i still have the same error

i enable a 2FA to resolve the problem but it didn’t have any effects.

when i launch old projects with a repo i have this error :

github.com username: saifbacari
github.com password for saifbacari (never stored):
Traceback (most recent call last):
35: from /home/saif/.rbenv/versions/2.6.3/bin/hub:23:in <main>' 34: from /home/saif/.rbenv/versions/2.6.3/bin/hub:23:in load’
33: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/bin/hub:9:in <top (required)>' 32: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:17:in execute’
31: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:17:in new' 30: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/runner.rb:12:in initialize’
29: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:63:in run' 28: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:687:in browse’
27: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:1002:in browse_command' 26: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:704:in block in browse’
25: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/2.6.0/forwardable.rb:230:in remote_branch_and_project' 24: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/context.rb:158:in remote_branch_and_project’
23: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/context.rb:158:in call' 22: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/commands.rb:870:in github_user’
21: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:50:in username_via_auth_dance' 20: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:552:in username’
19: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in fetch_value' 18: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in fetch’
17: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:464:in block in fetch_value' 16: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:553:in block in username’
15: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:54:in block in username_via_auth_dance' 14: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:204:in get’
13: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:395:in perform_request' 12: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:255:in perform_request’
11: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:384:in apply_authentication' 10: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:329:in apply_authentication’
9: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:567:in oauth_token' 8: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in fetch_value’
7: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:463:in fetch' 6: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:464:in block in fetch_value’
5: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:568:in block in oauth_token' 4: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:330:in block in apply_authentication’
3: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:346:in obtain_oauth_token' 2: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:346:in loop’
1: from /home/saif/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/hub-1.12.4/lib/hub/github_api.rb:364:in block in obtain_oauth_token' /home/saif/.rbenv/versions/2.6.3/lib/ruby/2.6.0/net/http/response.rb:122:in error!’: 401 “Unauthorized” (Net::HTTPServerException)

I will be grateful if someone find a solution,

thanks a lot !

I’m having the same issue here @saifbacari
did you managed to find a fix?

Yeah i updated hub bc it was an old version and i installed github CLI for my terminal to be authorized to use the token created on github.