Migrate from Github error 'Must specify two-factor authentication OTP code' #4508

Closed
opened 2025-11-02 05:52:59 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @jimOnAir on GitHub (Dec 18, 2019).

  • Gitea version (or commit ref): 1.10.1
  • Git version: 2.22.0
  • Operating system: Ubuntu 18.04 (Docker)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Hello. I'm trying to create mirror for private GitHub repository. I have 2FA enabled for my account.
I get an error in container logs:

2019/12/17 22:19:14 ...ask/queue_channel.go:33:Run() [E] Run task failed: GET <repo_address>: 401 Must specify two-factor authentication OTP code. []
Originally created by @jimOnAir on GitHub (Dec 18, 2019). - Gitea version (or commit ref): 1.10.1 - Git version: 2.22.0 - Operating system: Ubuntu 18.04 (Docker) - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Hello. I'm trying to create mirror for private GitHub repository. I have 2FA enabled for my account. I get an error in container logs: ```console 2019/12/17 22:19:14 ...ask/queue_channel.go:33:Run() [E] Run task failed: GET <repo_address>: 401 Must specify two-factor authentication OTP code. [] ```
GiteaMirror added the topic/ui label 2025-11-02 05:52:59 -06:00
Author
Owner

@lafriks commented on GitHub (Dec 18, 2019):

You need to use token not username/password if you have 2FA enabled

@lafriks commented on GitHub (Dec 18, 2019): You need to use token not username/password if you have 2FA enabled
Author
Owner

@lafriks commented on GitHub (Dec 18, 2019):

On failed task notification with error description should probably be shown instead of simply failing tho

@lafriks commented on GitHub (Dec 18, 2019): On failed task notification with error description should probably be shown instead of simply failing tho
Author
Owner

@jimOnAir commented on GitHub (Dec 18, 2019):

If I enter repo URL in format https://:@github.com/ I get 404 error:

2019/12/18 08:38:12 ...ask/queue_channel.go:33:Run() [E] Run task failed: Migration failed: Clone: exit status 128 - remote: Repository not found.
        fatal: repository '<repo address>' not found

My token has repo:status and read:org permissions. Repo belongs to the organization and I'm not owner of this organization.

@jimOnAir commented on GitHub (Dec 18, 2019): If I enter repo URL in format https://<github user>:<token>@github.com/<repo address> I get 404 error: ```console 2019/12/18 08:38:12 ...ask/queue_channel.go:33:Run() [E] Run task failed: Migration failed: Clone: exit status 128 - remote: Repository not found. fatal: repository '<repo address>' not found ``` My token has repo:status and read:org permissions. Repo belongs to the organization and I'm not owner of this organization.
Author
Owner

@lunny commented on GitHub (Dec 18, 2019):

@jimOnAir you should enter normal URL(without username/password) and then put your access token on username.

@lunny commented on GitHub (Dec 18, 2019): @jimOnAir you should enter normal URL(without username/password) and then put your access token on `username`.
Author
Owner

@jimOnAir commented on GitHub (Dec 18, 2019):

@lunny I'm still getting 404 error

2019/12/18 10:07:25 ...ask/queue_channel.go:33:Run() [E] Run task failed: GET https://api.github.com/repos/<repo address>: 404 Not Found []

Am I have insufficient permissions?

@jimOnAir commented on GitHub (Dec 18, 2019): @lunny I'm still getting 404 error ```console 2019/12/18 10:07:25 ...ask/queue_channel.go:33:Run() [E] Run task failed: GET https://api.github.com/repos/<repo address>: 404 Not Found [] ``` Am I have insufficient permissions?
Author
Owner

@lafriks commented on GitHub (Dec 18, 2019):

You need repo:read permissions probably

@lafriks commented on GitHub (Dec 18, 2019): You need `repo:read` permissions probably
Author
Owner

@jimOnAir commented on GitHub (Dec 18, 2019):

There is no such permission on GitHub. But, thanks, with a more permissive token I was able to clone the repository.

@jimOnAir commented on GitHub (Dec 18, 2019): There is no such permission on GitHub. But, thanks, with a more permissive token I was able to clone the repository.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4508