Force push seems doesn't work on protected branch with white list enabled #2321

Closed
opened 2025-11-02 04:32:46 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @gigi206 on GitHub (Sep 11, 2018).

  • Gitea version (or commit ref): 1.5.1
  • Git version:
  • Operating system: SLES12 SP3
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
  • Log gist:

Description

I activated protected branch with white list access :
protected branch

When I force push, I have the following message :

remote: Gitea: branch master is protected from force push        
To https://try.gitea.io/gigix/test.git
 ! [remote rejected] 4e308e02f18c0a51c687b32ff9699949e16204c4 -> master (pre-receive hook declined)
error: impossible de pousser des références vers 'https://try.gitea.io/gigix/test.git'

error

Is there an issue with withite list on protected branch ?

Originally created by @gigi206 on GitHub (Sep 11, 2018). - Gitea version (or commit ref): 1.5.1 - Git version: - Operating system: SLES12 SP3 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) : https://try.gitea.io/gigix/test - [ ] No - [ ] Not relevant - Log gist: ## Description I activated protected branch with white list access : ![protected branch](https://image.ibb.co/cAnxx9/Capture_d_cran_de_2018_09_11_20_42_04.png) When I force push, I have the following message : ``` remote: Gitea: branch master is protected from force push To https://try.gitea.io/gigix/test.git ! [remote rejected] 4e308e02f18c0a51c687b32ff9699949e16204c4 -> master (pre-receive hook declined) error: impossible de pousser des références vers 'https://try.gitea.io/gigix/test.git' ``` ![error](https://image.ibb.co/bGynx9/Capture_d_cran_de_2018_09_11_20_47_18.png) Is there an issue with withite list on protected branch ?
GiteaMirror added the type/question label 2025-11-02 04:32:46 -06:00
Author
Owner

@lafriks commented on GitHub (Sep 11, 2018):

I think it is intended behaviour. Without whitelist you can not even commit to that branch only use PRs

@lafriks commented on GitHub (Sep 11, 2018): I think it is intended behaviour. Without whitelist you can not even commit to that branch only use PRs
Author
Owner

@SagePtr commented on GitHub (Sep 11, 2018):

Whitelist allows certain users regular pushes, it does not allow force pushes.
Prevoiusly protected branch push whitelist allowed wide range of operation, even branch deletion, but this was fixed in #4607 and now it does allow what is said in the description.

@SagePtr commented on GitHub (Sep 11, 2018): Whitelist allows certain users regular pushes, it does not allow force pushes. Prevoiusly protected branch push whitelist allowed wide range of operation, even branch deletion, but this was fixed in #4607 and now it does allow what is said in the description.
Author
Owner

@gigi206 commented on GitHub (Sep 11, 2018):

Thank you for your reply.

If I need to enable merge whitelist, I must enable Branch protection.

Branch protection can be done by custom Git scripts hook. But if I want to code custom Git scripts hook for activate protected branch with force push then I can't enable merge whitelist without activated branch protection.

@gigi206 commented on GitHub (Sep 11, 2018): Thank you for your reply. If I need to **enable merge whitelist**, I must **enable Branch protection**. **Branch protection** can be done by custom Git scripts hook. But if I want to code custom Git scripts hook for activate protected branch with force push then I can't enable merge whitelist without activated branch protection.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2321