Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 813
Vinoth Avatar asked Sep 25 '18 04:09

Vinoth


People also ask

How do I see git repository permissions?

Open Security for a repository Open the web portal and choose the project where you want to add users or groups. To choose another project, see Switch project, repository, team. Open Project settings>Repositories. To set the permissions for all Git repositories, choose Security.

How do I know if I have permission from GitHub?

A very easy way to check is whether you see an edit 'pencil' icon in the top right of the README.MD on the main Code page of the repo (scroll down to it if there's a long list of top level files/folders). Do this when you are logged in to Github, obviously.

How do you check if a file has been modified in git?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.

Which command will you use to check the current status of all your files and git working directory?

The git status command displays the state of the working directory and the staging area.


1 Answers

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.

like image 79
VonC Avatar answered Oct 29 '22 23:10

VonC