By Jason Smith |

 

 

The SDCC provides Git services for use by experiments.

PHENIX

  • URL: https://git.racf.bnl.gov/gitea/phenix/ (Restricted to PHENIX collaborators only)
    • Authentication is required using your BNL RHIC login account name & password and all members of the rhphenix group can read/write.
  • Back-end server: rgitphenix.rcf.bnl.gov
    • Authorized users can log in via ssh to the back-end server to manage the git repositories.

sPHENIX

  • URL: https://git.racf.bnl.gov/gitea/sphenix/
    • Authentication is required using your BNL RHIC login account name & password and members of the sphenix group can read/write.
  • Back-end server: rgitsphenix.rcf.bnl.gov
    • Authorized users can log in via ssh to the back-end server to manage the git repositories.

 

User Documentation

The URLs provided above are for the more user-friendly Cgit web front-end. It has more features than the default gitweb CGI script and is faster since it does automatic caching. When browsing the Cgit web interface, each git repository will have a Clone link which you can use with your preferred git client to clone that repository. You cannot clone from the authenticated cgit URL since it authenticates with Shibboleth which uses HTTP cookies that most git clients cannot use.

Client Compatability

The RACF Git servers use a relatively new HTTP back-end service and therefore require a recent version of the client. We have tested and recommended at least these versions of some popular clients:

Authentication

You will need to authenticate using your login name and Kerberos password in order to access the repositories. If you have an older OS that comes with an old version of openssl (0.9.8e or earlier), like RHEL5, then you may see SSL certificate subject/hostname match errors. If you can't upgrade your OS or version of openssl, then you can work around these errors by telling git not to verify the server's host certificate:

git config http.sslVerify "false"

or

export GIT_SSL_NO_VERIFY="true"

 

 

If you prefer to use the git command-line client, then you may find some GUI tools useful, at least for visualizing the history and branches in your local working copy. Some common tools are "git GUI" and gitk, both of which come with the official git package, gitg for Gnome, or git-cola.

Client Configuration

Before using git you have to make sure that your client has a minimal configuration that includes your name and email address, in the following format:

cat ~/.gitconfig
[user]
	name = FirstName LastName
	email = username@domain.name
[http]
	postBuffer = 104857600

If you use the git command line and your terminal supports color, then you may also find config settings like this useful:

[color]
        ui = auto
[color "status"]
        branch = cyan

You can also use the Git CLI to set these parameters:

git config --global user.name "FirstName LastName"

git config --global user.email username@domain.name

git config --global http.postbuffer 104857600

If you use the Git CLI without configuring your identity, it will attempt to automatically detect it using your UNIX login info on your localhost, but it can only guess at your email address. You should configure your git client using your real name and email address before using git since this information will be used when recording your commit logs. The post-buffer configuration is needed when doing large size pushes to the Git web-server. If you use an editor that creates Tilda (~) backup files, you can have Git ignore them by adding this to your ~/.gitconfig:

[core]
        excludesfile = ~/.gitignore

and create a new ~/.gitignore file that contains simply `*~`:

cat ~/.gitignore
*~

When running git commands against the git web-server, you will need to authenticate, and depending on your OS, it may popup a GUI dialog box. For example, on RedHat using Gnome, it will default to the gnome-ssh-askpass command. You can disable this and force it to use the terminal prompt by unsetting the SSH_ASKPASS environment variable:

unset SSH_ASKPASS

Repository Management

To manage the git repositories, if you are authorized, you can ssh into the back-end git server from an ssh gateway server using your user account. Then using sudo, you can create, modify and delete your git repositories. Since all git web-access is made through apache, all git repository files are owned by the apache user. Note: all of the examples commands below assume a sub-directory in the git base called to test and a repository named repo, so you will need to make substitutions that were appropriate for your specific needs.

Main git server description

The git-web front-ends automatically include an HTML formatted text file, if it is found, at the top of the main or about web-page. You can modify its content by editing this file:

sudo -u apache vi /var/www/git/indextext.html

Creating a new git repository

The base of the git web-root is /var/www/git. Since cgit allows you to categorize and group your git repositories you might want to also make subdirectories in the git base to help keep your repos organized better:

sudo -u apache mkdir -p /var/www/git/test

sudo -u apache git init --bare /var/www/git/test/repo

This will create a new git repository named repo in the sub-directory test of the git base.

Repository description, category, and config

To set a description for your git repository, you can edit the description file and enter one sentence on a single line:

sudo -u apache vi /var/www/git/test/repo/description

To set the group name as displayed in the Cgit web front-end, you can edit the cgitrc file, which contains a single line like "section=Name", without the quotes:

sudo -u apache vi /var/www/git/test/repo/cgitrc

You can also change what the web front-end displays for the repository owner by editing the repo's config file:

sudo -u apache vi /var/www/git/test/repo/config

Just make a new section called gitweb and set the owner to what you want:

[gitweb]
        owner = Foo Bar
[user]
        name = Foo Bar
        email = git@foobar.com

You can also set these config parameters using the git command, like:

sudo -u apache git config --file /var/www/git/test/repo/config gitweb.owner "Foo Bar"

sudo -u apache git config --file /var/www/git/test/repo/config user.name "Foo Bar"

sudo -u apache git config --file /var/www/git/test/repo/config user.email git@foobar.com

The gitweb CGI script uses the gitweb.owner info, while the cgit web front-end uses the user.name info. If you install hooks in your git repositories that do merging or other actions that might create a commit in your git repo, since these commits are made by the apache user, the commit logs will be recorded using the user.name & user.email info that you defined in your repository. If you don't set anything, it will just say Apache.

Repository hooks

If you want to set up custom hooks for your git repository, then just install them into the hooks sub-directory. You can see the example hooks installed by git init:

ls -l /var/www/git/test/repo/hooks

The username of the user that is accessing the git web interface is available in your hook scripts in the environmental variable named GIT_COMMITTER_NAME.

Deleting a repository

To delete a repository, just recursively remove the repository directory:

sudo -u apache rm -rf /var/www/git/test/repo

Obviously, you want to be extremely careful. If you do make a mistake, a few days' worths of nightly tar backups of the git-web base directory can be found in the /backup directory, with names like git-backup-$DATE.$TIME.tar.gz. Be careful when extracting these, so you don't overwrite newer files in other git repos with old versions from the tar backup. If tape backups are set up for your git back-end server, then you can also make a request to ask the RACF staff to restore an older backup from tape if needed.