Difference between revisions of "Git"

From UFRC
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:Infrastructure]][[Category:Docs]][[Category:Revision Control]]
+
[[Category:Software]][[Category:Revision Control]]
=Using git.hpc.ufl.edu=
+
{|<!--CONFIGURATION: REQUIRED-->
==Request a group repository==
+
|{{#vardefine:app|git}}
As an example we'll use the ''awesome'' group, administrative user (set up by HPC staff) ''admin'' and a regular user ''student''.
+
|{{#vardefine:url|https://git-scm.com/}}
 +
<!--CONFIGURATION: OPTIONAL (|1}} means it's ON)-->
 +
|{{#vardefine:conf|}}          <!--CONFIGURATION-->
 +
|{{#vardefine:exe|1}}            <!--ADDITIONAL INFO-->
 +
|{{#vardefine:job|}}            <!--JOB SCRIPTS-->
 +
|{{#vardefine:policy|}}        <!--POLICY-->
 +
|{{#vardefine:testing|}}      <!--PROFILING-->
 +
|{{#vardefine:faq|}}            <!--FAQ-->
 +
|{{#vardefine:citation|}}      <!--CITATION-->
 +
|{{#vardefine:installation|}} <!--INSTALLATION-->
 +
|}
 +
<!--BODY-->
 +
<!--Description-->
 +
{{#if: {{#var: url}}|
 +
{{App_Description|app={{#var:app}}|url={{#var:url}}|name={{#var:app}}}}|}}
  
* Open a support ticket in the [http://support.rc.ufl.edu HPC Support]] ticket system with a name like "Create an HPC Git repository for the "Awesome" group.
+
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
* List your projected git usage:
 
  
#What group will be accessing it.
+
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
#Who would be the group administrator (username).
 
#How soon you need it set up.
 
#How much space you need i.e. what type of content is going to be stored in the repository.
 
#The uptime requirements i.e. whether the occasional downtime is acceptable.
 
#Where the repository administrator's public ssh key can be found (you can paste it into the support ticket).
 
  
* Assuming that your usage pattern falls within the limits of our resources we'll create a repository 'awesome' on git.hpc.ufl.edu and configure it for the administrator. After that the administrator 'admin' can do the following:
+
<!--Modules-->
 +
==Environment Modules==
 +
Run <code>module spider {{#var:app}}</code> to find out what environment modules are available for this application.
 +
==System Variables==
 +
* HPC_{{uc:{{#var:app}}}}_DIR - installation directory
  
==Repository Administration==
+
<!--Configuration-->
Check out the admin repository
+
{{#if: {{#var: conf}}|==Configuration==
git clone awesome@git.hpc.ufl.edu:gitolite-admin.git
+
See the [[{{PAGENAME}}_Configuration]] page for {{#var: app}} configuration details.
or change into the gitolite-admin directory if already cloned and run 'git pull' to refresh the local working tree from the server.
+
|}}
 +
<!--Run-->
 +
{{#if: {{#var: exe}}|==Additional Information==
  
===Add users===
+
UFRC git environment  module also contains a 'git-lfs' instance, so you can run 'git lfs ...' after loading the git environment module.
;Single machine
 
: e.g. user 'jdoe' working on a single machine who provided the repository administrator with a public ssh key named ''jdoe.pub''
 
cd gitolite-admin
 
cp ~/jdoe.pub keydir/
 
git add keydir/*
 
git commit -m "added user jdoe"
 
git push
 
  
;Additional machines
+
|}}
: if a user needs to access the repository from another machine named, for example, 'jdoe_laptop'
+
<!--Job Scripts-->
cd gitolite-admin/keydir
+
{{#if: {{#var: job}}|==Job Script Examples==
mkdir jdoe_laptop
+
See the [[{{PAGENAME}}_Job_Scripts]] page for {{#var: app}} Job script examples.
cp ~/jdoe.pub jdoe_laptop
+
|}}
git add *
+
<!--Policy-->
git commit -m "added a new key from jdoe_laptop for user jdoe"
+
{{#if: {{#var: policy}}|==Usage Policy==
git push
 
  
===Grant Access===
+
WRITE USAGE POLICY HERE (Licensing, usage, access).
Once a new user (but not a new key for an existing user) is added they need to be granted access to appropriate repositories. This is done by editing the config/gitolite.conf file, then committing and pushing the commit to the server.
 
  
For example, to allow access from users 'janedoe' and 'johndoe' to a repository 'test1' either add their gitolite key names to the access list for that repository or create a gitolite group, add the users to the group and grant the group access to the repository.
+
|}}
 +
<!--Performance-->
 +
{{#if: {{#var: testing}}|==Performance==
  
repo test1
+
WRITE_PERFORMANCE_TESTING_RESULTS_HERE
    RW+    =  janedoe johndoe
 
    R      =  @all
 
  
or
+
|}}
 +
<!--Faq-->
 +
{{#if: {{#var: faq}}|==FAQ==
 +
*'''Q:''' **'''A:'''|}}
 +
<!--Citation-->
 +
{{#if: {{#var: citation}}|==Citation==
 +
If you publish research that uses {{#var:app}} you have to cite it as follows:
  
repo test1
+
WRITE_CITATION_HERE
    RW+    =  @mygroup
 
    R      =  @all
 
  
# Groups
+
|}}
@test_group  = janedoe johndoe
+
<!--Installation-->
 
+
{{#if: {{#var: installation}}|==Installation==
Access types:
+
See the [[{{PAGENAME}}_Install]] page for {{#var: app}} installation notes.|}}
RW+ means 'Read and Write access'
+
<!--Turn the Table of Contents and Edit paragraph links ON/OFF-->
R  means 'Ready-only access'
+
__NOTOC____NOEDITSECTION__
 
 
===Create a new repository===
 
;For example, an admin wants to create a repository called ''denovo'' for ''de novo'' assembly scripts and set access to users ''admin'' and ''student''
 
cd gitolite-admin
 
vim conf/gitolite.conf
 
Add a group configuration:
 
@mygroup = admin student
 
Add a repository configuration
 
repo denovo
 
    RW+    =  @mygroup
 
    R      =  @all
 
* Commit and push
 
git add *
 
git commit -m "Set up a new repository denovo for use by admin and student"
 
git push
 
* Create a local working tree for the ''denovo'' project:
 
cd
 
mkdir denovo
 
cd denovo
 
git init
 
git remote add origin awesome@git.hpc.ufl.edu:denovo.git
 
* Add and edit some files
 
* Commit and push to the Git server
 
git add *
 
git commit -m "Initial import"
 
git push origin master
 
Output:
 
Initialized empty Git repository in /git/awesome/repositories/denovo.git/
 
Counting objects: 3, done.
 
Writing objects: 100% (3/3), 231 bytes, done.
 
Total 3 (delta 0), reused 0 (delta 0)
 
To awesome@git.hpc.ufl.edu:denovo.git
 
* [new branch]      master -> master
 
 
 
===User Activities===
 
Regular cycle of git repository usage
 
* Clone the ''denovo'' repository
 
git clone awesome@git.hpc.ufl.edu:denovo.git
 
Output:
 
Cloning into denovo...
 
remote: Counting objects: 3, done.
 
remote: Total 3 (delta 0), reused 0 (delta 0)
 
Receiving objects: 100% (3/3), done.
 
* Work in the git working tree
 
cd denovo
 
Edit and add files
 
* Commit and push the changes to the repository
 
git add *
 
git commit -m "The changes I made"
 
git push
 
 
 
==Git email reports==
 
We can enable Git email reports for any repository. Please email the support or file a suport ticket. Once enabled, every "push" to the remote repository on git.hpc.ufl.edu will produce a commit email report to a defined list of email addresses.
 
==Multiple SSH keys==
 
To enable a user to have multiple ssh keys for accessing the UFRC Git server the repository administrator can simply put the user's keys under subdirectories in the 'keydir', add, commit, and push as usual. The user must make sure they're using the right key. It's often convenient to create a SSH configuration for each particular combination of repositories and keys. For example,
 
 
 
* Edit your <code>~/.ssh/config</code> file on a local machine that need to be configured. Let's assume that the main configuration is
 
Host hpcgit
 
    HostName git.hpc.ufl.edu
 
    User awesomegroup
 
    IdentityFile ~/.ssh/id_rsa
 
   
 
To be able to use an alternate key add the following configuration
 
Host hpcgit2
 
    HostName git.hpc.ufl.edu
 
    User awesomegroup
 
    IdentityFile ~/.ssh/id_rsa_my_other_key
 
 
 
Once configuration is done you'll be able to check out the repository via
 
 
 
git clone hpcgit2:my_repository
 
 
 
'''Notes:''' Make sure that the '''User''' is set to your group's Git account and not your personal HPC account name.
 
 
 
==Graphical User Interfaces to Git==
 
[[TortoiseGit_Clone_Repository|How to use TortoiseGit to clone a Git Repository]]
 

Latest revision as of 17:09, 15 August 2022

Description

git website  

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Environment Modules

Run module spider git to find out what environment modules are available for this application.

System Variables

  • HPC_GIT_DIR - installation directory


Additional Information

UFRC git environment module also contains a 'git-lfs' instance, so you can run 'git lfs ...' after loading the git environment module.