Difference between revisions of "Git repositories"

From Wiki | LUG@UCLA
Jump to: navigation, search
Line 16: Line 16:
 
== Using the repository ==
 
== Using the repository ==
  
First, verify your repository has been created by accessing {{SERVER}}/git/. If your repository name is "my-project", then your push/pull address will be: <code>git@git.{{SERVERNAME}}:my-project.git</code> . Your repository will also have a public pull-only address at {{SERVER}}/git/my-project.git.
+
First, verify your repository has been created by accessing {{SERVER}}/git/. If your repository name is "my-project", then your push/pull address will be: <code>git@{{SERVERNAME}}:my-project.git</code> . Your repository will also have a public pull-only address at {{SERVER}}/git/my-project.git.
  
 
Start working with your repository by cloning it, committing some changes, then pushing those changes:
 
Start working with your repository by cloning it, committing some changes, then pushing those changes:
  
  $ git clone git@git.{{SERVERNAME}}:<strong><ins>my-project</ins></strong>.git
+
  $ git clone git@{{SERVERNAME}}:<strong><ins>my-project</ins></strong>.git
 
  $ cd <strong><ins>my-project</ins></strong>
 
  $ cd <strong><ins>my-project</ins></strong>
 
  $ echo "my super duper project!" >README.txt
 
  $ echo "my super duper project!" >README.txt
Line 30: Line 30:
  
 
  $ cd <strong><ins>path/to/existing/my-project</ins></strong>
 
  $ cd <strong><ins>path/to/existing/my-project</ins></strong>
  $ git remote add lug git@git.{{SERVERNAME}}:<strong><ins>my-project</ins></strong>.git
+
  $ git remote add lug git@{{SERVERNAME}}:<strong><ins>my-project</ins></strong>.git
 
  $ git push --all lug
 
  $ git push --all lug
 
  $ git push --tags lug
 
  $ git push --tags lug

Revision as of 20:07, 25 October 2013

>>> //linux.ucla.edu/git/ <<<

>>> git@linux.ucla.edu <<<

Git is a free and open source distributed version control system, and our preferred method of sharing source code. LUG@UCLA hosts members' Git repositories at the address above. This page provides an overview of the steps necessary to get your project hosted by LUG@UCLA.

Repository setup

If you don't already have an SSH key pair, you can follow these steps to generate one.

Give your public SSH key to a LUG admin so they can add your key to the system (Gitolite). Also, provide the LUG admin with three bits of information:

  1. a repository name
  2. a very short description of the repository (no more than 10 words)
  3. your email address

Using the repository

First, verify your repository has been created by accessing //linux.ucla.edu/git/. If your repository name is "my-project", then your push/pull address will be: git@linux.ucla.edu:my-project.git . Your repository will also have a public pull-only address at //linux.ucla.edu/git/my-project.git.

Start working with your repository by cloning it, committing some changes, then pushing those changes:

$ git clone git@linux.ucla.edu:my-project.git
$ cd my-project
$ echo "my super duper project!" >README.txt
$ git add README.txt
$ git commit --message="added a readme!"
$ git push origin master

If you already have a pre-existing local repository that you just want to push to your new LUG repository, just add a new remote and push all your branches to it:

$ cd path/to/existing/my-project
$ git remote add lug git@linux.ucla.edu:my-project.git
$ git push --all lug
$ git push --tags lug

Remember, you can pull the repository from anywhere, but you can only push from your personal computer (or wherever you generated your keys).

Links