Support Access Token when performing git operations #2449

Closed
opened 2025-11-02 04:36:39 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @gastaldi on GitHub (Oct 25, 2018).

  • Gitea version (or commit ref): 1.6
  • Git version: 2.19.0
  • Operating system: Fedora
  • Database:
    • PostgreSQL
    • [] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Steps to reproduce:

  1. Create an access token in your account
  2. Create a private repository
  3. git clone https://try.gitea.io/user/your_private_repo
  • Username: user
  • Password: Your Access Token
  1. Perform some changes and git commit
  2. git push
  • Username: user
  • Password: Your Access Token

You should see an Authentication Failed error

Description

GitHub supports authentication using a Personal Access Token as the password (which means that when performing a git push, I can specify my token as the password).
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#using-a-token-on-the-command-line

Gitea also supports Access Tokens. It would be nice if I could use the API token as the password when running git push.

Originally created by @gastaldi on GitHub (Oct 25, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.6 - Git version: 2.19.0 - Operating system: Fedora - Database: - [x] PostgreSQL - [] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [X] Yes (provide example URL) - [ ] No - [ ] Not relevant ## Steps to reproduce: 1. Create an access token in your account 2. Create a private repository 3. git clone https://try.gitea.io/user/your_private_repo - Username: user - Password: Your Access Token 4. Perform some changes and `git commit` 5. `git push` - Username: user - Password: Your Access Token You should see an Authentication Failed error ## Description GitHub supports authentication using a Personal Access Token as the password (which means that when performing a git push, I can specify my token as the password). https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#using-a-token-on-the-command-line Gitea also supports Access Tokens. It would be nice if I could use the API token as the password when running `git push`.
GiteaMirror added the issue/duplicate label 2025-11-02 04:36:39 -06:00
Author
Owner

@lafriks commented on GitHub (Oct 25, 2018):

I think this should be already possible

@lafriks commented on GitHub (Oct 25, 2018): I think this should be already possible
Author
Owner

@gastaldi commented on GitHub (Oct 25, 2018):

@lafriks it seems that the problem is that an admin cannot push to any repository. Is there any way to bypass that?

@gastaldi commented on GitHub (Oct 25, 2018): @lafriks it seems that the problem is that an admin cannot push to any repository. Is there any way to bypass that?
Author
Owner

@gastaldi commented on GitHub (Oct 25, 2018):

This is the scenario I am facing:

  • Having two users: Alice and Bob. Alice is Admin, Bob is a normal user.
  • Alice generates an Access Token and creates a repository under Bob's account using the Sudo support.
  • Now Alice wants to push content to this repository. git clone succeeds but git push fails with User permission denied
@gastaldi commented on GitHub (Oct 25, 2018): This is the scenario I am facing: - Having two users: Alice and Bob. Alice is Admin, Bob is a normal user. - Alice generates an Access Token and creates a repository under Bob's account using the [Sudo support](https://docs.gitea.io/en-us/api-usage/). - Now Alice wants to push content to this repository. `git clone` succeeds but `git push` fails with `User permission denied`
Author
Owner

@gastaldi commented on GitHub (Oct 25, 2018):

Seems to be a duplicate of https://github.com/go-gitea/gitea/issues/4292

@gastaldi commented on GitHub (Oct 25, 2018): Seems to be a duplicate of https://github.com/go-gitea/gitea/issues/4292
Author
Owner

@gastaldi commented on GitHub (Oct 25, 2018):

Closing it, since #4292 seems to be the problem I am facing

@gastaldi commented on GitHub (Oct 25, 2018): Closing it, since #4292 seems to be the problem I am facing
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2449