Hosting documentation/Git

From Bioinformatics.Org Wiki

(Difference between revisions)
Jump to: navigation, search
m (Creating a fork as a developer)
m (Creating a fork as a developer)
Line 62: Line 62:
  $ git merge upstream/master
  $ git merge upstream/master
-
The following commands could be used to apply the changes back to the master branch on the server:
+
The following commands could be used to apply any changes back to the master branch on the server:
  $ git add .
  $ git add .

Revision as of 08:02, 2 May 2013

Contents

Anonymous Git access

Anonymous Git access uses git-daemon and does not require SSH.

To clone (download) a repository from the server, type the following on your local computer, making the necessary obvious substitution for the repository name:

$ git clone git://bioinformatics.org/gitroot/repository.git [directory]

Note that you do not need to specify the destination directory. If you are checking out a repository named "bioworks", for example, you could change to the directory where you want the repository to be placed, and then type the following:

$ git clone git://bioinformatics.org/gitroot/bioworks

And any future changes on the server can be merged with the clone on your local computer by using the following commands:

$ git fetch origin
$ git merge origin/master

Git clients

If you are using a Unix-variant, Git clients are easy to find or may already be installed on your system. Simply type git to see if you have one.

Developer access

For all developer (read/write) access, you will be using SSH (Secure Shell). The SSH (2.x or better) client must be available on your local computer. Note that you will need to type in your password for commands that change the repository on the server.

Creating a repository as a developer

This part requires logging into the shell on the server.

Important: You may choose any place on the server (to which you have access) to create a Git repository and import your code. However, if you want to enable anonymous downloads, the repository has to be in the directory /gitroot, and you must use the following commands.

From your shell account on the Bioinformatics.Org server, type the following, where repository should be the unix name of your group:

$ newgrp git
$ umask 002
$ cd /gitroot
$ mkdir repository.git
$ cd repository.git
$ git init --bare --shared=0664
$ touch git-daemon-export-ok
$ echo git://bioinformatics.org/gitroot/repository.git > cloneurl

Importing source code into a new Git repository as a developer

On your local computer, type the following, where directory is the directory you want to import, repository is the unix name of your group, and username is your shell account username on the server:

$ cd directory
$ git init
$ git remote add upstream ssh://username@bioinformatics.org/gitroot/repository.git
$ git add .
$ git commit -m 'message about import'
$ git push upstream master

Creating a fork as a developer

On your local computer, type the following, where directory is the directory you want to use for the fork, repository is the unix name of your group, and username is your shell account username on the server:

$ git clone ssh://username@bioinformatics.org/gitroot/repository.git [directory]
$ cd directory
$ git remote add upstream ssh://username@bioinformatics.org/gitroot/repository.git
$ git fetch upstream
$ git merge upstream/master

The following commands could be used to apply any changes back to the master branch on the server:

$ git add .
$ git commit -m 'message about change'
$ git push upstream master

See also

External links

Please refer to the Git documentation for more information on working with Git:

Personal tools
Namespaces
Variants
Actions
wiki navigation
Toolbox