4 Version Control with Git
4.1 Readings
4.2 Install Git
4.2.1 For windows
- Download the Git for Windows installer.
- Run the installer and follow the steps bellow:
- Click on “Next”.
- Click on “Next”.
- Keep “Use Git from the Windows Command Prompt” selected and click on “Next”. If you forgot to do this, rerun the installer and select the appropriate option.
- Click on “Next”.
- Keep “Checkout Windows-style, commit Unix-style line endings” selected and click on “Next”.
- Keep “Use Windows’ default console window” selected and click on “Next”.
- Click on “Install”.
- Click on “Finish”.
- If your “HOME” environment variable is not set (or you don’t know what this is):
- Open command prompt (Open Start Menu then type cmd and press [Enter])
- Type the following line into the command prompt window exactly as shown:
setx HOME "%USERPROFILE%"
- Press [Enter], you should see
SUCCESS: Specified value was saved
. - Quit command prompt by typing exit then pressing [Enter]
4.2.2 For Mac
Install git-osx-installer.
4.2.3 For Linux
install `git’ from your distro’s package manager.
4.3 Lesson
Adapted from Version Control with Git by Software Carpentry.
- A quick overview of Version Control
- Start off by registering a github account at https://github.com
- Use your github user name and email to config git. Open a Shell/Command line window from RStudio menu Tools/Shell…, and modify and run the following commands:
git config --global user.name "Liming Wang"
git config --global user.email "lmwang@gmail.com"
git config --global color.ui "auto"
4.4 Exercise
- Set up your git installation for use with GitHub;
- Turn the RStudio project you have been working on into a git repository;
- Commit it to github by following these steps: http://happygitwithr.com/existing-github-last.html.