Branch Protection Unprotected file patterns not working #11574

Closed
opened 2025-11-02 09:41:29 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @aHcVolle on GitHub (Aug 31, 2023).

Description

I was using the unprotected file patterns for branch protection earlier and everything was working as expected.
Since updating (sorry i have no idea from which version I did update) this seems to be not working anymore.
I cannot push to the protected branch even if the filename should match the filter.

Example:
Setup a repo with enabled branch protection for branch main with disabled push and unprotected file patterns for "test*".
Try to push a file "testfile.txt" -> "Not allowed to push to protected branch main"

This was working before but i'm note sure which version i updated from.

Gitea Version

1.20.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

debian

How are you running Gitea?

I'm running gitea in the latest docker container but this problem exists in try.gitea.io, too.

Database

None

Originally created by @aHcVolle on GitHub (Aug 31, 2023). ### Description I was using the unprotected file patterns for branch protection earlier and everything was working as expected. Since updating (sorry i have no idea from which version I did update) this seems to be not working anymore. I cannot push to the protected branch even if the filename should match the filter. Example: Setup a repo with enabled branch protection for branch main with disabled push and unprotected file patterns for "test*". Try to push a file "testfile.txt" -> "Not allowed to push to protected branch main" This was working before but i'm note sure which version i updated from. ### Gitea Version 1.20.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System debian ### How are you running Gitea? I'm running gitea in the latest docker container but this problem exists in try.gitea.io, too. ### Database None
GiteaMirror added the type/bug label 2025-11-02 09:41:30 -06:00
Author
Owner

@lng2020 commented on GitHub (Sep 1, 2023):

I followed your instructions but the rule worked well.
Is there another commit that includes a protected file? Can you please give more specificated information?

@lng2020 commented on GitHub (Sep 1, 2023): I followed your instructions but the rule worked well. Is there another commit that includes a protected file? Can you please give more specificated information?
Author
Owner

@aHcVolle commented on GitHub (Sep 1, 2023):

OK, I just gave this another try but I still cannot push a file in my test repo on try.gitea.io.
Maybe I'm understanding it somehow wrong.
I've attached a screenshot which shows my repo settings and the error message. This is the only commit that is pending to be pushed...
prot_test

@aHcVolle commented on GitHub (Sep 1, 2023): OK, I just gave this another try but I still cannot push a file in my test repo on try.gitea.io. Maybe I'm understanding it somehow wrong. I've attached a screenshot which shows my repo settings and the error message. This is the only commit that is pending to be pushed... ![prot_test](https://github.com/go-gitea/gitea/assets/6406817/7c9f8f96-d19b-46c2-8857-531cb8d3c632)
Author
Owner

@lng2020 commented on GitHub (Sep 1, 2023):

OK, I just gave this another try but I still cannot push a file in my test repo on try.gitea.io. Maybe I'm understanding it somehow wrong. I've attached a screenshot which shows my repo settings and the error message. This is the only commit that is pending to be pushed... prot_test

thanks for your patience! I encounter the same issue now. I'm looking into it.

@lng2020 commented on GitHub (Sep 1, 2023): > OK, I just gave this another try but I still cannot push a file in my test repo on try.gitea.io. Maybe I'm understanding it somehow wrong. I've attached a screenshot which shows my repo settings and the error message. This is the only commit that is pending to be pushed... ![prot_test](https://user-images.githubusercontent.com/6406817/264961663-7c9f8f96-d19b-46c2-8857-531cb8d3c632.png) thanks for your patience! I encounter the same issue now. I'm looking into it.
Author
Owner

@lng2020 commented on GitHub (Sep 1, 2023):

We use . and / as separators. So in the matching pattern, the file extension should be specified. prot_test*.* or prot_test** will solve your problem.

@lng2020 commented on GitHub (Sep 1, 2023): We use `.` and `/` as separators. So in the matching pattern, the file extension should be specified. `prot_test*.*` or `prot_test**` will solve your problem.
Author
Owner

@aHcVolle commented on GitHub (Sep 1, 2023):

you are completely right, using prot_test** is working fine and I'm super sorry for the disturbance.
I tried so many things and I was 100% sure I also tried ** but I think I was wrong :)

thank you very much!

@aHcVolle commented on GitHub (Sep 1, 2023): you are completely right, using prot_test** is working fine and I'm super sorry for the disturbance. I tried so many things and I was 100% sure I also tried ** but I think I was wrong :) thank you very much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11574