How to check remote GIT repository permission without commit/add any files or modify any files

37,999

You can at least check if the remote repo is still remotely readable with git ls-remote

From any folder in your local machine, type git ls-remote /url/remote/repo.

But for any more advance permission check, you would need to go to the remote server hosting that repo.

Or at list query that server, listing the members for a given project.
See GitLab API "List all members of a group or project".
Each member has access_level which will give a fined-grained permission.

10 => Guest access
20 => Reporter access
30 => Developer access
40 => Maintainer access
50 => Owner access # Only valid for groups

Note that GitLab 15.1 (June 2022) adds:

API includes additional detail about who added members

The members API now returns more information about who added a user to a project or group in the new created_by field.

Thank you Rémy Jacquin for your contribution!

See Documentation and Issue.

Share:
37,999
Vinoth
Author by

Vinoth

Keen to learn and adapting new skills. Specialties: Languages Skills : ShellScript, Python. Industrial experience: Automating build and deployments jobs, production support. CICD set up using Jenkins,Docker,GIT,Ansible tools. Setting up logging, monitoring and alerting frameworks.

Updated on September 26, 2020

Comments

  • Vinoth
    Vinoth over 3 years

    I'm trying to find remote GIT repository permission without any file changes. I have tried below command,

    "git push --dry-run"
    

    its shows, everything-up-to-date.

    The problem is I have cloned my remote repository after that I removed all my permission in remote git repository I want to know the remote repository permission before any local changes I made.

  • Vinoth
    Vinoth over 5 years
    Thanks, for helping,we are using with LDAP group for around 100 people, for the particular remote repository everybody has R- READ permission, i want to verify remote repository permission without "go to the remote server hosting and verify repo" more like i need result in terminal itself.
  • VonC
    VonC over 5 years
    @vinoth You still need to query the server somehow, and list the project members. I have edited the answer accordingly. The result will be displayed "in the terminal itself".
  • Vinoth
    Vinoth over 5 years
    thank you. i was looking for any GIT commands to verify the remote repository permission. anyhow at-last we are going to use API calls only.
  • VonC
    VonC over 5 years
    @vinoth Yes, good move: Git itself knows nothing about permission. Only the remote Git repositories hosting server knows about said permission, hence the API calls. GitLab is not Git.
  • Vinoth
    Vinoth over 5 years
    yeah, i knew that we are using same as like gitlab its called gitblit