Github Setup
We'll mainly use Github to share assignments for the majority of this course. Git is a powerful tool that we'll cover in more depth later. For now, though, we just need to focus on setting up your account to clone a repository.
- Create a GitHub account
- Go to the GitHub website https://github.com/ and click on the "Sign up" button in the top right corner of the page
- Follow the instructions to create your account.
- Choose a plan - GitHub offers free plans for personal use.
- Verify your email address by checking your email and clicking on the verification link.
- Install Git
- Go to the Git website https://git-scm.com/ and click on the "Download" button.
- Download the appropriate installer for your operating system.
- Run the installer and use the default settings to install Git.
- Create an SSH key
- Open Git Bash (Windows) or Terminal (Mac).
- Enter the following command, replacing the email with your own
- When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
- Choose a password to secure your SSH key, and enter it twice when prompted. You won't see the password, but don't worry; it's there.
- Add your SSH key to your GitHub account
- Go to your GitHub account settings by clicking on your profile picture in the top right corner of the page and then clicking on "Settings."
- Click on "SSH and GPG keys" in the left sidebar.
- Click on the "New SSH key" button.
- Enter a title for your SSH key (e.g. "My Laptop").
- Open the file that contains your SSH key (typically ~/.ssh/id_rsa.pub on Linux/Mac or C:\Users\username\.ssh\id_rsa.pub on Windows) with a text editor like Notepad and copy all of the text.
- Paste the contents into the "Key" field on the GitHub website.
- Click on the "Add SSH key" button to save your SSH key.
- Clone the Git repository
- Go to the GitHub page for the repository you want to clone. https://github.com/Hjhawley/TechClass
- Click on the "Clone or download" button on the right side of the page.
- Click on the "Use SSH" button to copy the SSH URL of the repository to your clipboard.
- Open a terminal (or command prompt) on your computer.
- Navigate to the directory (folder) where you want to clone the repository.
- Enter the following command (replace "username" and "repository"):
- Once the cloning process is complete, you should see a new directory containing the files from the repository.
- Configure Git
- Open a terminal or command prompt on your computer and enter the following commands, replacing "Your Name" and "your_email@example.com" with your actual name and email address:
- These settings will be applied to all repositories on your computer.
- You should now be able to access the cloned repository from your file explorer. You can also add the directory to your workspace within VS Code.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
git clone git@github.com:username/repository.git
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"