Difference: GitSetup (5 vs. 6)

Revision 62013-02-04 - brodbd

Line: 1 to 1

Creating a Git Repo

Line: 38 to 38
  The solution is to make your shared repository a "bare" repository, with no working copy. The git FAQ has a good example of how to convert a non-"bare" repository to a "bare" one. For more information, see the description of "--bare" in the git-clone manpage or this stackoverflow thread.

Dealing with File Permissions

*NOTE:* Since the December 2012 file server upgrade, using a script to fix permissions after pushes shouldn't be necessary any longer. It won't hurt anything either, though, so if you have an existing repository with a permission-fix script, there's no need to disable it.

Due to a peculiarity in the way file permissions behave between patas and other clients, you will also need to set up a script to run chown and chmod commands when files are checked in, otherwise they might only be readable by the group member that checked them in. To do this:

  1. Inside your git repo (it may be inside a subdirectory titled ".git/"), there is a subdirectory entitled "hooks/"
  2. You will want to create a file inside the hooks directory called "post-receive".
  3. This file will be a script file that will be executed whenever someone successfully pushes to the repository. It may be any type of script, but the following script will make certain the permissions for the files in your repository allow access to all of your group members:
    # Make sure all files are set to be owned by the group.
    chown -R --from=`whoami` :<GROUP_NAME> <SHARED_DIRECTORY>
    # Set all directories to 770 (Read/Write/List for owner and group members, noone else)
    find <SHARED_DIRECTORY> -user `whoami` -type d -exec chmod 770 {} \;
    # Add read/write permissions for owner and group (preserve executable permission) and remove permissions for others.:
    find <SHARED_DIRECTORY> -user `whoami` -type f -exec chmod ug+rw {} \; -exec chmod o-rwx {} \;
    Where <GROUP_NAME> and <SHARED_DIRECTORY> are replaced with the group name you should have received from linghelp, and the root directory of your repository, respectively.
  4. After this file is created, be sure to perform:
    chgrp <GROUP_NAME> hooks/post-receive
    chmod g+rx hooks/post-receive
    to ensure that the script is executable by each group member when performing the PUSH.
  5. Set the initial group membership by running "chgrp -R <GROUP_NAME>" on the repository directory.
META FILEATTACHMENT attachment="Git_Flowchart.png" attr="" comment="Flowchart for which type of git repo to create." date="1304534556" name="Git_Flowchart.png" path="Git Flowchart.png" size="43690" stream="Git Flowchart.png" tmpFilename="/usr/tmp/CGItemp62948" user="rgeorgi" version="1"
This site is powered by the TWiki collaboration platformCopyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Privacy Statement Terms & Conditions