netrc x-oauth-basic no longer works since 1.2.0-rc1 #1050

Closed
opened 2025-11-02 03:46:34 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @Sharsie on GitHub (Sep 10, 2017).

  • Gitea version: 1.2.0-rc1, 1.2.0-rc2
  • Git version: 2.11.0
  • Operating system: docker image gitea/gitea on Debian 4.9.30-2+deb9u3 (kernel 4.9.0-3-amd64)
  • Database:
    • 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, coming here from drone's discourse forum, it is no longer possible to authenticate using the x-oauth-basic as used previously in version 1.1.4

git clone https://{TOKEN}:x-oauth-basic@gitea.my.domain/Org/Repo.git

yields

remote: invalid credentials fatal: Authentication failed for 'https://{TOKEN}:x-oauth-basic@gitea.my.domain/Org/Repo.git/'

In version 1.1.4 it succesfully clones the repository.

Using

git clone https://{USERNAME}:{TOKEN}@gitea.my.domain/Org/Repo.git

it is possible to clone the repository in version 1.2.0-rc1 and 1.2.0-rc2

This unfortunatelly breaks the drone builds as the plugins/git docker image uses the x-oauth-basic to clone the repository. I am not sure if there was a decistion to drop the x-oauth-basic or if it is a bug since I did not find a relevant issue or a mention of the change in changelog. So it is not clear whether the issue should be fixed from the side of gitea or if the drone plugin should be updated to support the current scheme.

How to reproduce:

  1. Create a new private repository on try.gitea.com
  2. Add a new application under your profile settings
  3. Try to clone the repository using the application's token git clone https://{OAUTH_TOKEN_REDACTED}:x-oauth-basic@try.gitea.com/Org/Repo.git
  4. Verify the token is valid by cloning the repo using your username git clone https://{USERNAME}:{TOKEN}@try.gitea.com/Org/Repo.git
Originally created by @Sharsie on GitHub (Sep 10, 2017). - Gitea version: 1.2.0-rc1, 1.2.0-rc2 - Git version: 2.11.0 - Operating system: docker image gitea/gitea on Debian 4.9.30-2+deb9u3 (kernel 4.9.0-3-amd64) - Database: - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: ## Description Hello, coming here from [drone's discourse](https://discourse.drone.io/t/cannot-clone-private-gitea-repo-could-not-read-username-for-0-8-0-rc-3-gitea-1-2-0-rc2/624/3) forum, it is no longer possible to authenticate using the x-oauth-basic as used previously in version 1.1.4 `git clone https://{TOKEN}:x-oauth-basic@gitea.my.domain/Org/Repo.git` yields `remote: invalid credentials fatal: Authentication failed for 'https://{TOKEN}:x-oauth-basic@gitea.my.domain/Org/Repo.git/'` In version 1.1.4 it succesfully clones the repository. Using `git clone https://{USERNAME}:{TOKEN}@gitea.my.domain/Org/Repo.git` it is possible to clone the repository in version 1.2.0-rc1 and 1.2.0-rc2 This unfortunatelly breaks the drone builds as the [plugins/git](https://github.com/drone-plugins/drone-git) docker image uses the x-oauth-basic to clone the repository. I am not sure if there was a decistion to drop the x-oauth-basic or if it is a bug since I did not find a relevant issue or a mention of the change in changelog. So it is not clear whether the issue should be fixed from the side of gitea or if the drone plugin should be updated to support the current scheme. ## How to reproduce: 1. Create a new private repository on try.gitea.com 2. Add a new application under your profile settings 3. Try to clone the repository using the application's token `git clone https://{OAUTH_TOKEN_REDACTED}:x-oauth-basic@try.gitea.com/Org/Repo.git` 4. Verify the token is valid by cloning the repo using your username `git clone https://{USERNAME}:{TOKEN}@try.gitea.com/Org/Repo.git`
GiteaMirror added the issue/regression label 2025-11-02 03:46:34 -06:00
Author
Owner

@kinnarr commented on GitHub (Sep 12, 2017):

It's a regression from #2184

@kinnarr commented on GitHub (Sep 12, 2017): It's a regression from #2184
Author
Owner

@olymk2 commented on GitHub (Sep 18, 2017):

Just hit this myself, anyone working on a fix ?

@olymk2 commented on GitHub (Sep 18, 2017): Just hit this myself, anyone working on a fix ?
Author
Owner

@lunny commented on GitHub (Sep 19, 2017):

Have you enabled 2FA?

@lunny commented on GitHub (Sep 19, 2017): Have you enabled 2FA?
Author
Owner

@olymk2 commented on GitHub (Sep 19, 2017):

nope, just upgraded via docker pull not sure why that would help ?

as far as I know drone does not do two factor in this way.
happy to be proven wrong and give it a try, if I go to enable it I need to give the passcode to drone so not sure where I would do that ?

@olymk2 commented on GitHub (Sep 19, 2017): nope, just upgraded via docker pull not sure why that would help ? as far as I know drone does not do two factor in this way. happy to be proven wrong and give it a try, if I go to enable it I need to give the passcode to drone so not sure where I would do that ?
Author
Owner

@jcgruenhage commented on GitHub (Sep 20, 2017):

@olymk2 2FA wouldn't help, it's just that the PR introducing this bug was about disabling regular https auth for 2FA users, allowing them only to pull via https with a token.

@jcgruenhage commented on GitHub (Sep 20, 2017): @olymk2 2FA wouldn't help, it's just that the PR introducing this bug was about disabling regular https auth for 2FA users, allowing them only to pull via https with a token.
Author
Owner

@olymk2 commented on GitHub (Sep 23, 2017):

in case its helpful this is the original discussion on the drone forum

https://discourse.drone.io/t/cannot-clone-private-gitea-repo-could-not-read-username-for-0-8-0-rc-3-gitea-1-2-0-rc2/624/2

@olymk2 commented on GitHub (Sep 23, 2017): in case its helpful this is the original discussion on the drone forum https://discourse.drone.io/t/cannot-clone-private-gitea-repo-could-not-read-username-for-0-8-0-rc-3-gitea-1-2-0-rc2/624/2
Author
Owner

@Sharsie commented on GitHub (Oct 13, 2017):

@tboerger has made a PR to drone to support the username/token requirements of gitea >=1.2.0 https://github.com/drone/drone/pull/2241

Not sure if the issue is still relevant because of other software compatibility or if the username/token combination will become a new requirement.

@Sharsie commented on GitHub (Oct 13, 2017): @tboerger has made a PR to drone to support the username/token requirements of gitea >=1.2.0 https://github.com/drone/drone/pull/2241 Not sure if the issue is still relevant because of other software compatibility or if the username/token combination will become a new requirement.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1050