In this section we will install a distributed version-control system Git, register a new user at GitHub and connect them together.
git config --global user.name "Your Name"
git config --global user.email "your_email@unil.ch"
Replace “Your Name” with your preferred name or the name you want to associate with your Git commits. Please also use your UNIL email address, so that we can exploit GitHub Student Developer Pack afterwards.
Check yourself: You can verify your Git configurations by running the following command:
git config --global --list
It will display your configured username and email.
Note: For Mac users, Git could be already preinstalled. However, Apple does not provide the latest version, that is why we have just installed the latest Git.
Note: Sometimes RStudio has a wrong path to git
command. To check it, go to Tools -> Global Options… -> Git/SVN, check the box “Enable version control interface for RStudio projects”. Then, “Git executable” and which git
/where git
(for Mac/Windows users, respectively) should be the same. Otherwise, copy the path from Terminal to RStudio.
To check if it worked, type which git
in Terminal and expect to see /usr/local/bin/git
.
Visit https://github.com and fill in the fields. Please use the same email address and short username without special symbols like hyphen, periods, etc. Furthermore, use free plan.
Set up a GitHub Student Developer Pack by visiting https://education.github.com/.
Note: The next step can be avoided (more convenient) by installing GitHub Desktop.
In the left sidebar, click on “SSH and GPG keys.” Follow the instructions provided by GitHub to set up an SSH key for secure communication between your computer and GitHub. This will allow you to authenticate without entering your password each time you interact with GitHub via Git. Once the SSH key is set up, you can start using Git on your computer as described previously. You will be able to interact with your GitHub repositories by cloning them, pushing changes, and pulling updates.
Note: For more details, follow steps at https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account
Using GitHub Desktop eliminates the need to manually set up SSH keys, as the application handles authentication using your GitHub account credentials. It provides a more visual and user-friendly experience for working with Git and GitHub repositories.
Here’s how you can use GitHub Desktop instead of setting up an SSH key:
To clone an existing GitHub repository, click on “File” in the top menu, then “Clone Repository.” Select the repository you want to clone from the list, choose the destination folder on your computer, and click on the “Clone” button.
Once the repository is cloned, you can make changes to your files by editing, adding, or deleting them within the repository folder on your computer.
GitHub Desktop will detect the changes automatically. You can review the changes, provide a summary of the changes made, and click on the “Commit” button to create a commit with the changes. You will also have the option to sync the changes to your GitHub repository using the “Push” button.
GitHub Desktop provides an intuitive interface to manage branches, create new branches, pull changes from remote repositories, and perform various Git operations without using the command line.
You can also consider GitKraken as an alternative to GitHub Desktop.