Issue
In JGit, is it possible to check developer permissions without doing the actions (provided username and password)?
Ex: Is it possible to check if a user can clone a repository without cloning it?
Ex2: Is it possible to check if a user can push to a repository without pushing to it?
Solution
Ex1
I think, this is not supported by git
itself, so no. (I might be wrong though)
As a workaround, one might use CloneCommand#setNoCheckout(boolean)
[1], which prevents downloading any branch (clone command should be pretty quick). The cloned repository (cloned into some temp directory), might be removed immediately, if call succeeded.
Ex2
For push, dry-run
can be used. Supported by JGit [2].
Most of the commands have some form of dry-run
option.
See: Do all git commands have a dry-run option?
--
Answered By - hradecek