I am building a (somewhat limited) Git client. To set up a repository, you enter the URL to the remote repo. I want to check whether the user has read+write access to that repository. If not, I present an authentication dialog.
I check 'read' access with git ls-remote <url>
.
Is there an analogous way to check 'write' access, without cloning the repo first? (I know I could git clone <url>
and then git push --dry-run
)
Go the branch that you want to edit and hover over the edit button and it might say "Fork this repository and edit this file", if you have no access to the repository. But suppose you have some access to the repository, then the hover message will show "Edit this file", but you might not have access to commit to the branch. To check access to a particular branch, you can click on the edit button and on the submit changes form,you will see "Commit changes", if you have access. Or if you don't have access, you will see "Propose Changes" as it will create a new branch.