Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.



Git Repository Permissions



If someone does not have read or write access to a Git repository, then chances are that the Git repository permissions need changing.

Assuming your Git server supports these commands (github does support them), you can run this command to display the read and write permissions of a Git repository.

$ ssh git@github.com getperms directory_name/repository_name.git
READERS @all USER_ID_1 USER_ID_2
EDITORS USER_ID_1 USER_ID_2 USER_ID_3


The accounts that have reading permissions are listed under the "READERS" variable, and the accounts that have writing permissions are listed under the "EDITORS" variable. You can use the wildcard "@all" to specify all users, or you can specify user ids.

To change the permissions, first create a text file with the contents exactly like the output above. I recommend saving the output of the command above to a text file, like this.

ssh git@github.com getperms directory_name/repository_name.git > FILENAME.txt

Next, edit the text file as you deem necessary. Finally, set the permissions using this command.

cat FILENAME.txt | ssh git@github.com setperms directory_name/repository_name.git

I recommend re-running the first command to verify that you set the Git repository permissions correctly.

by Phil for Humanity
on 20121027

Related Articles
 » Git Executable Permissions
 » Git Clone
 » Git Changes