Skip to content

GuusKolpa/git-workshop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Table of contents

Install on Windows

  1. Download git from here

  2. 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

  3. ...

  4. 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

Creating your first git repository

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\

Create a git folder for your repositories

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

Create a local repository

Next we'll create a seperate directory which is going to become our first git repo

mkdir hello_git
cd hello_git
git init

Add your first file

Create a python file by entering the following command

touch hello.py

Open edit mode by entering vim hello.py
Insert some text in the file by typing print('Hello GitHub!')
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.

How to get started with GitHub

Create a GitHub account

Go here and create an account. Make sure to select the Free subscription.

Generating an SSH key

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

Push your local repo to GitHub

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.

Group assignment

If you're in an instructor led class you can now go to the folder group_assignment and follow the instructions

Resources

About

Reference material on how to use Git

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%