Background¶
If you would like to use git to manage a shared project but do not want to host it on a world-readable service such as github, we can create a project account for you to contain one or more git repositories. You and your colleagues can read and write to the repositories once your access has been established through SSH in one of two ways:
By depositing your public SSH key into the shared account
By establishing your own SCF account
The first method allows you to use your preferred software on your personal machine, but also requires that you have git and ssh software installed on your computer. The second method does not require that you have any software other than SSH, but does require that you use the UNIX tools available at the SCF.
Creating the repository¶
Statistics faculty should send an email to manager@stat
PROJECT_NAME:~$ mkdir REPO_NAME
PROJECT_NAME:~$ git init --bare --shared REPO_NAMEwhere REPO_NAME is the name of the repository.
Accessing the repository using SSH keypairs¶
Collaborators should see our instructions
on creating SSH keypairs. Once you send your public key to
manager@stat
user@laptop:~$ git clone ssh://PROJECT_NAME@gandalf.berkeley.edu/accounts/projects/FAC_NAME/PROJECT_NAME/REPO_NAMEAccessing the repository using an SCF account¶
Collaborators may also fill out our guest account form if you would like for them to have an SCF account. Once it has has been created, they will have direct read access to the repository for cloning:
git clone ~PROJECT_NAME/REPO_NAMEUsing git¶
The SCF has prepared some documentation on using git. A basic workflow, after you have cloned the repository, is:
# Create a new file
vi doc1.tex
# Add it to the repository
git add doc.tex
# Record your changes. You will be prompted to describe your changes.
git commit
# Write your changes to the repository. You only need to set the origin once.
# All other pushes can omit the --set-upstream action.
git push --set-upstream origin master
# Edit an existing document
vi doc2.tex
# Record and write your changes
git commit
git push
# Pull the most current version with changes from others
git pullIf the cloned repository is on your personal computer rather than in your SCF account, you will be able to use your preferred text editor to create and/or edit files.