Installing and Using git
Installing git
- In order to locally edit the ontology and push changes back to the GitHub repository, you will need to have git installed on your machine.
- To check if you already have git installed, or to see what version of git you have, type either of these commands in your terminal: which
git
orgit --version
. - To install
git
, follow instructionshere: https://git-scm.com/
Note for MacOSX users: it is advised to install Command Line Tools for Xcode
.
Cloning the go-ontology repository from GitHub
- Create a directory called repos on your local machine using this command: mkdir repos.
- Do a cd to the new directory (alternatively, the GO repo can be cloned in any directory)
- Then paste this command into your terminal:
git clone https://github.com/geneontology/go-ontology.git
.- Example result:
Cloning into 'go-ontology'... remote: Counting objects: 2541, done. remote: Compressing objects: 100% (100/100), done. remote: Total 2541 (delta 52), reused 0 (delta 0), pack-reused 2440 Receiving objects: 100% (2541/2541), 21.19 MiB | 5.22 MiB/s, done. Resolving deltas: 100% (1532/1532), done.
Editing the .profile (or .bashrc) file to indicate the branch you are working on
It can be very helpful to know what branch you are working in on your terminal window. You can set this up to display by adding the following information to your .profile file (found by typing ls -a):
export GO_REPO=~/repos/go-ontology . $GO_REPO/src/util/git-completion.bash parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } PS1="\w\$(parse_git_branch) $ " export PATH=$PATH:$HOME/bin/
Note the last line is not relevant to git, but we do this now for later on when we want to run tools like robot.
Identifying the user for commits
Git needs to know who is committing changes to the repository, so the first time you commit, you may see the following message:
Committer: Kimberly Van Auken <vanauken@kimberlukensmbp.dhcp.lbnl.us> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate.
You can suppress this message by setting your name and email explicitly:
- Type
git config --global user.name "Your Name"
- Type
git config --global user.email you@example.com
(Use the email registered with GitHub). - You can then fix the identity used for this commit by typing:
git commit --amend --reset-author
.
Resetting password on command line (mac)
- In the terminal, type
git config --global --unset user.password
- When you push a branch, you will be asked for your user name and password.
- Enter your new token. It should be saved in your keychain for future uses.
Resetting password in Keychain
It may be that your old password is getting cached in your keychain. Please see: https://docs.github.com/en/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain
Updating GitHub token
See https://docs.google.com/document/d/1BUXPotmW1i3aQeqKv-68TM8nqgSs1VLOCUhOvliuaTk/edit#
Review Status
Last reviewed: September 9, 2021