- Install on windows
- Creating your first git repository
- How to get Started with GitHub
- Group assignment
- Resources
-
Download git from here
-
Go through the installer steps. It is recommended to look at every step, but if you do not understand a 100%, the default settings are OK
-
...
-
Profit! You have installed git
NOTE: The following parts all use the commandline. Windows users are recommended to install a decent terminal. If you do not have one, the Git Bash terminal will work as well
It is good practice to have your git repositories in one place.
For the following paragraphs, our git folder will be in C:\Users\user\Documents\
Open up the terminal and enter the following commands
cd ~\Documents
mkdir git
cd git
This folder can be used to store all your git repositories
Next we'll create a seperate directory which is going to become our first git repo
mkdir hello_git
cd hello_git
git init
Create a python file by entering the following command
touch hello.py
Open edit mode by entering vim hello.py
, if you prefer nano that's fine, I've chosen vim as it comes preinstalled on most OS
Press i
to enter insert-mode and insert some text in the file by typing print('Hello GitHub!')
Press Esc
to exit insert-mode, save and close the file by entering :wq
Great! Now let's add and commit your file to your local repository
git add .
git commit -m "initial commit"
Your files and changes are now saved in your local repository, next we'll work on pushing the files to GitHub so your code is always backed-up and shareable with people around the world.
Go here and create an account. Make sure to select the Free subscription.
SSH keys are used for authentication and allow you to connect to GitHub without supplying your username and password every time. Read on how to create your SSH key here
First, go to Github and in the topright click 'New repository'
Name the repository "hello_git", leave all the other settings as they are and click 'create'
At the top of the hello_git repo you'll find a quick setup. Copy either the link for HTTPS or SSH
Enter the following commands in GitBash:
git remote add origin <paste url here>
git push origin master
You've done it! Your first piece of code is now pushed to GitHub.
If you're in an instructor led class you can now go to the folder group_assignment and follow the instructions