How to get the code - CMCC-Foundation/CMCC-CM GitHub Wiki
The repository can be cloned locally with the command
git clone https://github.com/CMCC-Foundation/CMCC-CM.git
and you will have to provide your github username and password.
If you already have setup an SSH key in your github profile, use the following
git clone [email protected]:CMCC-Foundation/cesm.git
By default, you will see the code of cmcc-cm branch which is the current head of the model development. Use @git log@ to check the revision update. If you are not able to clone the repository checkout out your account settings see Setup Github access.
To get a list of all available (local and remote) branches of the code
git branch -a
To switch to the a specific branch use
git checkout <BRANCHNAME>
After checking out a new branch, always run checkout_externals
:
./manage_externals/checkout_externals
This will check out the correct version of all of the model's externals.
If it is the first time you use git on a machine, now it's the right moment to setup your own details!
git config --global user.name "Your Name Comes Here"
git config --global user.email [email protected]
It might be useful also to setup the coloured GIT interface for the shell:
git config color.ui true
The best way to work with github is to setup access authentication via ssh key, which can be then stored in the local machine where you do want to clone the repository. To associate private/public key pair to your github account go to the setting page "https://github.com/settings/keys":https://github.com/settings/keys NOTE: There is no need to generate a new ssh key for any machine where you want to clone the git repository. There is also no need to generate a ssh key if you already have one.
CREATE A NEW KEY PAIR: A personal private/public key pair can be generated using the @ssh-keygen@ command +on the machine+ that will be used for working on the code.
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
f6:61:a8:27:35:cf:4c:6d:13:22:70:cf:4c:c8:a0:23
USE AN EXISTING KEY: simply copy your private key (rename it to something like id_rsa_github to avoid overwrite). In case you have more than one identity, you must configure ssh to use the right identity to access github.com, by creating the file @.ssh/config@ with the following content and associating the private identity file that pairs with the public key you uploaded in your github account setting.
Host github.com
IdentityFile ~/.ssh/id_rsa_github