Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about git push -f #5731

Closed
mojie126 opened this issue Jan 15, 2019 · 14 comments
Closed

about git push -f #5731

mojie126 opened this issue Jan 15, 2019 · 14 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/enhancement An improvement of existing functionality

Comments

@mojie126
Copy link

Wishing to increase the authority to control compulsory push restrictions

@zeripath
Copy link
Contributor

It's not quite clear what you're asking. Gitea has protected branches so only certain users can push to that branch. Are you talking about adding a git hook for push - as in an arbitrary script that will check a commit and ensure that it passes some test?

OK, well obviously we can't produce a UI for that - it would mean allowing users to arbitrarily upload scripts that would be run on push. If you are the administrator and owner of the gitea server you should be able to edit the repository on the filesystem to add such a git hook - however remember that will be run during pushes so could lock the system.

Another option is to use the Gitea webhook system - the push will be accepted and then a webhook will be called which could then checkout the pushed commits and do the tests - it could then comment back on a PR or automatically push on to the master.

@lunny
Copy link
Member

lunny commented Jan 16, 2019

@zeripath I think he means we should add an option on protected branch to disallow users who have push permission to force push. @mojie126 Is that your issue?

@mojie126
Copy link
Author

是的,限制强制推送,可以控制谁能强制推送...

@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 16, 2019
@stale
Copy link

stale bot commented Mar 17, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Mar 17, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Mar 17, 2019
@lafriks
Copy link
Member

lafriks commented Mar 17, 2019

But when setting protected branch it will already be protected from forced push even if set that user are allowed to do push to that branch

@lafriks lafriks added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Mar 17, 2019
@lunny
Copy link
Member

lunny commented Mar 18, 2019

@lafriks I think @mojie126 means he want to give somebody push permission but cannot force push. Currently gitea didn't split them as two options.

@lafriks
Copy link
Member

lafriks commented Mar 27, 2019

But it already works this way. If I specify branch protection and whitelist user who can push to that branch that user will be able to push new commits but won't be able to force push

@0x5c
Copy link
Contributor

0x5c commented Apr 5, 2019

Could it be that the OP is asking for a repository setting? Ie: blanket denying of force-pushes

@stale
Copy link

stale bot commented Jun 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jun 4, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jun 4, 2019
@stale stale bot removed the issue/stale label Jun 4, 2019
@davidsvantesson
Copy link
Contributor

I think this would be solved with the combination of setting writers as push whitelist (similar as suggested in #8288) and wildcard branch protection (#2529). Then you can disable force pushing of the complete repository but still allow normal pushes.

@lunny
Copy link
Member

lunny commented Nov 2, 2019

How to allow someone could push but cannot force push then?

@davidsvantesson
Copy link
Contributor

There is already a database element for this; CanPush in ProtectedBranch. Currently it is always false (not used in any way)

@davidsvantesson
Copy link
Contributor

What seem to be wanted here (google translated from Chinese):

Yes, limit forced push, you can control who can force push...

I don't see the point of enabling force pushing for everyone to a protected branch (that would be like not protecting the branch). So it does only make sense in combination of a whitelist. And I suppose it should be different whitelists for who can push normal and who can force push? What is the use case here?

@mrsdizzie
Copy link
Member

closing per lack of feedback

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/enhancement An improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

7 participants