User Tools

Site Tools


support:services:git

Git Version Control Service

The git project is a distributed version control system. It can do everything that a centralized version control system can do, and more. Benefits include allowing collaboration without a centrally managed host and the ability to take full advantage of the version control system while online or off.

Request a New Project

If you would like to start using the CSE git server all you need to do is send the following information to help@cse and we will create a project for you.

  • Your project name - should be short and include no spaces or special chacters
  • A short description of the project
  • Details about permissions - Who has commit/write access, who can read/clone/pull access, and if you want it to be world readable

Getting Started

This section describes how to use git at CSE.

Authentication

The git server uses SSH public key authentication. This means that you need to generate a public and private key (if you haven't already) and send the public portion (usually ending in .pub) to the help@cse.

URLs

There are a few URLs that are used for this service.

Read-Only Repo Access

For pulling from a public repository you can use the URL: git://vcs.cse.ucdavis.edu/REPONAME where REPONAME is replaced with the repository name.

Commit Repo Access

If you have commit access (read and write) you should authenticate using your ssh key and use the following URL: git@vcs.cse.ucdavis.edu:REPONAME where REPONAME is replaced with the repository name. This method communicates over TCP port 22 (ssh).

Web Browsing the Source

You can allow anonymous or authenticated web browsing of a repository. You can access the repository using the following URL: https://vcs.cse.ucdavis.edu/git/REPONAME.git where REPONAME is replaced with the repository name. This service runs over the TCP/443 port (HTTPS).

Configure the Client

There are a few steps that need to be completed before you can commit to your repository.

Install Git

This is somewhat outside of the scope of this document. Most Linux distributions support git out of the box. You can search the web for how to install git on your laptop/workstation.

http://help.github.com/win-set-up-git/ is a link to configuring GIT and ssh keys in the Windows environment. You can stop at step 4 under “Set Up SSH Keys”. At this point you just need to send us (admins@cse.ucdavis.edu) your public key.

Using Git

Although there are a lot of more valuable resources available on the web here are a few shortcuts.

The Initial Import

Once the project has been added, and you are ready to import your code. Run the following to import the code in your current directory into the trunk.

    $ git clone git@vcs.cse.ucdavis.edu:REPONAME
    $ cd REPONAME
    $ mkdir modules
    $ cp /tmp/mymodule REPONAME/modules/mymodule
    $ git add REPONAME/modules/mymodule
    $ git commit -a -m "adding my module"  # commits changes to local git repo
    $ git push origin master # push the changes back to the server

Cloning (or Checking Out)

If you want to change the source code you have to first clone it.

    $ git clone git@vcs.cse.ucdavis.edu:REPONAME

Checking In (aka committing)

To check in changes changes to your source tree you need to commit them to the local git repository. Don't forget to git add any files added since the last commit. This works offline and offers most of the advantages of a centralized version control system except surviving a local disk crash.

Unlike all centralized version control systems you do not need to be “online” to do this with git.

    $ git commit -a -m "updated module a to use inline assembly"

Pushing a Repository

With git you can push your committed changes to a remote repository using the push command. This will make the remote repository look just like yours, including a full history of any local changes.

    $ git push

Pulling a Repository

With git you can pull any remotely made changes into your repository. This will make your repository look like the remote repository.

    $ git pull

Other Resources

Here are a few websites offering more help on the topic of Git and Gitolite.

Administration

This section is intended for administrators.

Creating a New Repository

This section is targeted at the git admins. We use gitolite to manage git repositories. To create a repo you need to first clone the gitolite-admin repository.

    $ git clone git@vcs.cse.ucdavis.edu:gitolite-admin
    $ cd gitolite-admin/conf
    $ vi gitolite.conf
    $ git commit -a -m "created new repo testProject and gave user JoeCommit commit access"   
    $ git push # this will actually push the changes 

An example repo entry:

repo testProject   # create repo with name testProject
    RW = JoeCommit # add JoeCommit to users that can commit
    R = gitweb # provide world readable web browsing interface for that user
    R = daemon # provide world readable git cloning
    test "test project owner" = "test project description"

Now the new repository will be available for users.

# for anonymous/random users that wants a copy:
$ git clone git://vcs.cse.ucdavis.edu/testProject

# for someone with commit access that wants a copy:
$ git clone git@vcs.cse.ucdavis.edu:testProject

# for someone that wants to browse the world readable repo with gitweb:
$ firefox https://vcs.cse.ucdavis.edu/git/testProject.git
support/services/git.txt · Last modified: 2013/10/25 16:24 by bill