Unable to git-push to existing repos (probably related to the unit feature) #802

Closed
opened 2025-11-02 03:37:17 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @typeless on GitHub (Jun 12, 2017).

Originally assigned to: @lunny on GitHub.

  • Gitea version (or commit ref):
    Gitea Version: 1.1.0+292-g113b3e9

  • Git version:
    2.7.4

  • Operating system:
    Ubuntu 16.04 64bit

  • 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

Got rejected and an error message User Scott does not have allowed access to repository my/test-repo's code while doing git push. It worked before.

A quick search gives me the clue but I don't quite understand what it's about.

if !repo.CheckUnitUser(authUser.ID, authUser.IsAdmin, unitType) {
    ctx.HandleText(http.StatusForbidden, fmt.Sprintf("User %s does not have allowed access to repository %s 's code",
    authUser.Name, repo.RepoPath()))
    return
}
```
...
Originally created by @typeless on GitHub (Jun 12, 2017). Originally assigned to: @lunny on GitHub. - Gitea version (or commit ref): Gitea Version: 1.1.0+292-g113b3e9 - Git version: 2.7.4 - Operating system: Ubuntu 16.04 64bit - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Got rejected and an error message `User Scott does not have allowed access to repository my/test-repo's code` while doing `git push`. It worked before. A quick search gives me the clue but I don't quite understand what it's about. ```` if !repo.CheckUnitUser(authUser.ID, authUser.IsAdmin, unitType) { ctx.HandleText(http.StatusForbidden, fmt.Sprintf("User %s does not have allowed access to repository %s 's code", authUser.Name, repo.RepoPath())) return } ``` ...
GiteaMirror added the type/bug label 2025-11-02 03:37:17 -06:00
Author
Owner

@lunny commented on GitHub (Jun 12, 2017):

It means the user have no right to push to this project.

@lunny commented on GitHub (Jun 12, 2017): It means the user have no right to push to this project.
Author
Owner

@typeless commented on GitHub (Jun 13, 2017):

@lunny I see. But the write permission has been enabled for the user in the 'Collaboration' settings and it worked before the recent update. What other settings should I check first or probably can diagnose?

@typeless commented on GitHub (Jun 13, 2017): @lunny I see. But the write permission has been enabled for the user in the 'Collaboration' settings and it worked before the recent update. What other settings should I check first or probably can diagnose?
Author
Owner

@lunny commented on GitHub (Jun 13, 2017):

I will test it.

@lunny commented on GitHub (Jun 13, 2017): I will test it.
Author
Owner

@typeless commented on GitHub (Jun 13, 2017):

So far I found that the problem is due to some users in the organization don't belong to any team.

See https://github.com/go-gitea/gitea/blob/master/models/repo.go#L366. When the user does not belong to any team, the slice teams will be empty. And then the following slice construction code will get nothing to built upon as well.

For now I can workaround this problem by creating a team for all non-owner members.

@typeless commented on GitHub (Jun 13, 2017): So far I found that the problem is due to some users in the organization don't belong to any team. See https://github.com/go-gitea/gitea/blob/master/models/repo.go#L366. When the user does not belong to any team, the slice `teams` will be empty. And then the following slice construction code will get nothing to built upon as well. For now I can workaround this problem by creating a team for all non-owner members.
Author
Owner

@lunny commented on GitHub (Jun 13, 2017):

So a Collaboration of one repo on an organization should be given read/write rights for all units? I think yes. I will send a PR to fix this.

@lunny commented on GitHub (Jun 13, 2017): So a Collaboration of one repo on an organization should be given read/write rights for all units? I think yes. I will send a PR to fix this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#802