SlideShare a Scribd company logo
GIT & GITHUB BASICS
GameCraft Training 
Radoslav Georgiev (@Rado_G)
DISCLAIMER
I’m not a Git expert or pro 
Agenda
• Why use Source Control System ?
• How to setup Git and Github on Windows ?
• Terminology
• Repositories 1.0 – git {init, add, commit, push, remote}
• Repositories 2.0 – .gitignore, git {clone, pull, revert, mv,
  rm}
• Fork & Pull + Shared Repos
Why use Source Control Systems ?
          What is ?                     Why use ?



• SCS are a tool that helps   • Keeps the developing
  keeping versions of the       process simple
  code                        • All files are hosted
• SCS allow multiple            (Github)
  developers to work on the   • No nose bleed!
  same code with minimum      • Tons of благинки
  amount of collisions
No Source Control System =
Agenda
• Why use Source Control System ?
• How to setup Git and Github on Windows ?
• Terminology
• Repositories 1.0 – git {init, add, commit, push, remote}
• Repositories 2.0 – .gitignore, git {clone, pull, revert, mv,
  rm}
• Fork & Pull + Shared Repos
How to setup Git and Github on
Windows?
• First of all – create a Github Account
• And second :




• There’s a great guide @ the Github site -
 http://help.github.com/win-set-up-git/
How to setup Git and Github on
Windows? cont’d
• You’ll need msysgit (Linux shell)
• You’ll have to generate an SSH key-pair
   • And think of a passphrase ! <- Important
• You’ll have to add the SHH keys to your Github account
• Then test :   $ ssh –T git@github.com
                some output .. (yes/no)
                $ yes
                Hi username! You‟ve successfully authenticated, but Github
                does not provide shell access.



• gg, wp
And some configuration ^_^
• Name & Email – Github tracks them
$ git config –global user.name “Firstname Lastname”
$ git config –global user.email “email@email.com”



• Github API token
  • On the GitHub site Click “Account Settings” > Click “Account
    Admin.”
$ git config –global github.user username
$ git config –global github.token the_token
DEMO TIME
1) Create a Github account
2) Set up with Windows
Agenda
• Why use Source Control System ?
• How to setup Git and Github on Windows ?
• Terminology
• Repositories 1.0 – git {init, add, commit, push, remote}
• Repositories 2.0 – .gitignore, git {clone, pull, revert, mv,
  rm}
• Fork & Pull + Shared Repos
Some basic Terminology
• git = the shell command to work with Git
• repo = Repository, where the code for a given project is
    kept
•   commit = verb, means push the code to the server (in
    Git, commit = (commit + push)
•   diff = the difference between two versions of a file
•   SSH = Secure SHell – Network protocol for
    communication between machines
•   RSA = Rivest, Shamir, Adleman – public-key
    cryptography algorithm
    $ command
    Output of the command
Agenda
• Why use Source Control System ?
• How to setup Git and Github on Windows ?
• Terminology
• Repositories 1.0 – git {init, add, commit, push,
  remote}
• Repositories 2.0 – .gitignore, git {clone, pull, revert, mv,
  rm}
• Fork & Pull + Shared Repos
Lets create a repo !
• Click on the new repository button in Github
• Start the shell (Git Bash)
• Execute the super-complex command :
  $ git init
  Initialized empty Git repository in c:/code/TestingGithub/.git/


• Great, now we have repo. Lets create a file, shall we ?
  $ touch omgrofl.txt
  $ notepad omgrofl.txt (and add text) or $ echo “rofllol” > omgrofl.txt
  $ cat omgrofl.txt  cat prints to the output
  rofllol
Lets create a repo ! (cont’d)
• Okay, lets add it !

  $ git add omgrofl.txt


• And commit it 
  $ git commit –m „This is a commit message‟
  Some gitorish output

• And for the sake of learning, lets edit it again
  $ echo “roflcopter” >> omgrofl.txt
  $ cat omgrofl.txt
  rofllol
  roflcopter
Lets create a repo ! (cont’d)
• And now, lets see :

  $ git status


• Outputs :
  # On branch master
  # Changes not staged for commit:
  # (use "git add <file>..." to update what will be committed)
  # (use "git checkout -- <file>..." to discard changes in working directory)
  #
  #    modified: omgrofl.txt


• Almost there
  $ git add omgrofl.txt
  $ git status
How it works? Staging area.
What about Github ? Remotes ?
• Okay, you suck, there’s nothing @ Github
• Damn. Enter magic!
  $ git remote add origin git@github.com:UserName/ProjectName.git


• Git commits locally, pushes remotely !!!!!!!
• Add the remote when the repo is created (git init,
 remember ? )
  $ git remote add [name] [url]


• Want to see the remotes ?
  $ git remote -v
What about Github ? Push it up, baby!
• Okay, we have committed and added a remote to Github.
 It’s time to push 
  $ git push origin master
  Enter passphrase ! 

• Open up the repo in Github and enjoy ^_^
• The push command explained :
  $ git push [remote_name] [branch]


• Branches are black magic for later 
• There’s a big chance that the branch you are pushing to
 will be named “master”
Recap ! Creating a repo
• Create a repo
  $ git init



• Add an remote
  $ git remote add origin git@github.com:UserName/ProjectName.git



• Check if directory is a git repo
  $ ls –la
  Search for .git folder
Recap ! The workflow.
• Edit files and check the status
  $ git status

• Add them to the staging area
  $ git add file1.php file2.php file3.php
• Commit the changes
  $ git commit –m „Commit message that explains the changes‟
• Push them to Github
  $ git push origin master
  Enter passphrase!

• Celebrate ! 
DEMO
1) Create yourself a repo (from Github)
2) Add and Commit few files
3) Push them !
4) Repeat 2) and 3) few times
TAKE A BREAK.
We all deserve it 
Agenda
• Why use Source Control System ?
• How to setup Git and Github on Windows ?
• Terminology
• Repositories 1.0 – git {init, add, commit, push, remote}
• Repositories 2.0 – .gitignore, git {clone, pull, revert,
  mv, rm}
• Fork & Pull + Shared Repos
Don’t push your passwords
• Use .gitignore
  $ touch .gitignore
  $ echo “db_config.php” >> .gitignore
  $ git add .gitignore
  $ git push origin master
  Enter passphrase!



• Something missing ?
  $ git commit –m „You are not seeing my passwords!‟
Made a mistake ? No worries
• Unstage something – git reset

$ git add index.php
$ git status
Says it‟s staged. I don‟t want to ! I changed my mind.
$ git reset HEAD – index.php
$ git status
Now I‟m happy ^_^


• Revert a commit ? Reset hard!
 $ git reset –hard HEAD~1
 OR
 $ git reset –hard <commit_id>
Fork time.
• If you want to get a repo – fork is the way.
• Fork on github and then
 $ git clone git@github.com:UserName/ProjectName.git
• This inits a new Git repository!
• You can do everything with the code now – this is a
  separate repository.
• More @ http://help.github.com/fork-a-repo/
Shared repos
• If you are added as a collaborator @ some repo – you
  can do everything (clone, add, commit, push) without
  restrictions.
• Shared repos mean more developers. More Developers =
  more changes.

 $ git pull [remote_name]

• This will pull the latest changes 

More Related Content

What's hot (20)

PPTX
Git One Day Training Notes
glen_a_smith
 
PDF
Git basics
GHARSALLAH Mohamed
 
PDF
Git and github 101
Senthilkumar Gopal
 
PPTX
Introduction git
Dian Sigit Prastowo
 
PDF
Starting with Git & GitHub
Nicolás Tourné
 
PPTX
Intro to git and git hub
Venkat Malladi
 
PDF
Git and Github slides.pdf
Tilton2
 
PPTX
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
PDF
Git and Github
Wen-Tien Chang
 
PPTX
Git - Basic Crash Course
Nilay Binjola
 
PDF
Introduction to Git
Yan Vugenfirer
 
PPTX
Git and GitHub
Md. Ahsan Habib Nayan
 
PPT
Git basic
Emran Ul Hadi
 
PPTX
Git basics to advance with diagrams
Dilum Navanjana
 
PDF
Intro to Git and GitHub
Panagiotis Papadopoulos
 
PPTX
Introduction to Git and GitHub Part 1
Omar Fathy
 
PDF
Git training v10
Skander Hamza
 
PDF
Git - An Introduction
Behzad Altaf
 
PPTX
Git
Shinu Suresh
 
PPTX
Git and Github Session
GoogleDevelopersStud1
 
Git One Day Training Notes
glen_a_smith
 
Git basics
GHARSALLAH Mohamed
 
Git and github 101
Senthilkumar Gopal
 
Introduction git
Dian Sigit Prastowo
 
Starting with Git & GitHub
Nicolás Tourné
 
Intro to git and git hub
Venkat Malladi
 
Git and Github slides.pdf
Tilton2
 
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Git and Github
Wen-Tien Chang
 
Git - Basic Crash Course
Nilay Binjola
 
Introduction to Git
Yan Vugenfirer
 
Git and GitHub
Md. Ahsan Habib Nayan
 
Git basic
Emran Ul Hadi
 
Git basics to advance with diagrams
Dilum Navanjana
 
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Introduction to Git and GitHub Part 1
Omar Fathy
 
Git training v10
Skander Hamza
 
Git - An Introduction
Behzad Altaf
 
Git and Github Session
GoogleDevelopersStud1
 

Similar to Github basics (20)

PPT
Git installation and configuration
Kishor Kumar
 
PPTX
Basic Git commands
Jitendra Zaa
 
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
PPTX
Beginner's guide to git and github
SahilSonar4
 
PPT
Git 101 - Crash Course in Version Control using Git
Geoff Hoffman
 
PPTX
Demo
Miracle Anyanwu
 
PPT
Github By Nyros Developer
Nyros Technologies
 
PPT
Git is a distributed version control system .
HELLOWorld889594
 
PDF
Introduction to Git for Artists
David Newbury
 
ODP
Git presentation
Vikas Yaligar
 
KEY
Git isthenewsexy
Ailsa126
 
KEY
Gitting the Most From Git
Chris Miller
 
PPTX
Introduction To Git Workshop
themystic_ca
 
PDF
Git 101 Workshop
Joy Seng
 
PPTX
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
PPT
GIT-FirstPart.ppt
ssusered2ec2
 
PDF
The Basics of Open Source Collaboration With Git and GitHub
BigBlueHat
 
PPTX
Git: Why And How to
lanhuonga3
 
PDF
Git Tutorial I
Jim Yeh
 
PPT
Introduction to Git and Github
Somkiat Puisungnoen
 
Git installation and configuration
Kishor Kumar
 
Basic Git commands
Jitendra Zaa
 
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
Beginner's guide to git and github
SahilSonar4
 
Git 101 - Crash Course in Version Control using Git
Geoff Hoffman
 
Github By Nyros Developer
Nyros Technologies
 
Git is a distributed version control system .
HELLOWorld889594
 
Introduction to Git for Artists
David Newbury
 
Git presentation
Vikas Yaligar
 
Git isthenewsexy
Ailsa126
 
Gitting the Most From Git
Chris Miller
 
Introduction To Git Workshop
themystic_ca
 
Git 101 Workshop
Joy Seng
 
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
GIT-FirstPart.ppt
ssusered2ec2
 
The Basics of Open Source Collaboration With Git and GitHub
BigBlueHat
 
Git: Why And How to
lanhuonga3
 
Git Tutorial I
Jim Yeh
 
Introduction to Git and Github
Somkiat Puisungnoen
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Python basic programing language for automation
DanialHabibi2
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Ad

Github basics

  • 1. GIT & GITHUB BASICS GameCraft Training  Radoslav Georgiev (@Rado_G)
  • 2. DISCLAIMER I’m not a Git expert or pro 
  • 3. Agenda • Why use Source Control System ? • How to setup Git and Github on Windows ? • Terminology • Repositories 1.0 – git {init, add, commit, push, remote} • Repositories 2.0 – .gitignore, git {clone, pull, revert, mv, rm} • Fork & Pull + Shared Repos
  • 4. Why use Source Control Systems ? What is ? Why use ? • SCS are a tool that helps • Keeps the developing keeping versions of the process simple code • All files are hosted • SCS allow multiple (Github) developers to work on the • No nose bleed! same code with minimum • Tons of благинки amount of collisions
  • 5. No Source Control System =
  • 6. Agenda • Why use Source Control System ? • How to setup Git and Github on Windows ? • Terminology • Repositories 1.0 – git {init, add, commit, push, remote} • Repositories 2.0 – .gitignore, git {clone, pull, revert, mv, rm} • Fork & Pull + Shared Repos
  • 7. How to setup Git and Github on Windows? • First of all – create a Github Account • And second : • There’s a great guide @ the Github site - http://help.github.com/win-set-up-git/
  • 8. How to setup Git and Github on Windows? cont’d • You’ll need msysgit (Linux shell) • You’ll have to generate an SSH key-pair • And think of a passphrase ! <- Important • You’ll have to add the SHH keys to your Github account • Then test : $ ssh –T [email protected] some output .. (yes/no) $ yes Hi username! You‟ve successfully authenticated, but Github does not provide shell access. • gg, wp
  • 9. And some configuration ^_^ • Name & Email – Github tracks them $ git config –global user.name “Firstname Lastname” $ git config –global user.email “[email protected]” • Github API token • On the GitHub site Click “Account Settings” > Click “Account Admin.” $ git config –global github.user username $ git config –global github.token the_token
  • 10. DEMO TIME 1) Create a Github account 2) Set up with Windows
  • 11. Agenda • Why use Source Control System ? • How to setup Git and Github on Windows ? • Terminology • Repositories 1.0 – git {init, add, commit, push, remote} • Repositories 2.0 – .gitignore, git {clone, pull, revert, mv, rm} • Fork & Pull + Shared Repos
  • 12. Some basic Terminology • git = the shell command to work with Git • repo = Repository, where the code for a given project is kept • commit = verb, means push the code to the server (in Git, commit = (commit + push) • diff = the difference between two versions of a file • SSH = Secure SHell – Network protocol for communication between machines • RSA = Rivest, Shamir, Adleman – public-key cryptography algorithm $ command Output of the command
  • 13. Agenda • Why use Source Control System ? • How to setup Git and Github on Windows ? • Terminology • Repositories 1.0 – git {init, add, commit, push, remote} • Repositories 2.0 – .gitignore, git {clone, pull, revert, mv, rm} • Fork & Pull + Shared Repos
  • 14. Lets create a repo ! • Click on the new repository button in Github • Start the shell (Git Bash) • Execute the super-complex command : $ git init Initialized empty Git repository in c:/code/TestingGithub/.git/ • Great, now we have repo. Lets create a file, shall we ? $ touch omgrofl.txt $ notepad omgrofl.txt (and add text) or $ echo “rofllol” > omgrofl.txt $ cat omgrofl.txt  cat prints to the output rofllol
  • 15. Lets create a repo ! (cont’d) • Okay, lets add it ! $ git add omgrofl.txt • And commit it  $ git commit –m „This is a commit message‟ Some gitorish output • And for the sake of learning, lets edit it again $ echo “roflcopter” >> omgrofl.txt $ cat omgrofl.txt rofllol roflcopter
  • 16. Lets create a repo ! (cont’d) • And now, lets see : $ git status • Outputs : # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: omgrofl.txt • Almost there $ git add omgrofl.txt $ git status
  • 17. How it works? Staging area.
  • 18. What about Github ? Remotes ? • Okay, you suck, there’s nothing @ Github • Damn. Enter magic! $ git remote add origin [email protected]:UserName/ProjectName.git • Git commits locally, pushes remotely !!!!!!! • Add the remote when the repo is created (git init, remember ? ) $ git remote add [name] [url] • Want to see the remotes ? $ git remote -v
  • 19. What about Github ? Push it up, baby! • Okay, we have committed and added a remote to Github. It’s time to push  $ git push origin master Enter passphrase !  • Open up the repo in Github and enjoy ^_^ • The push command explained : $ git push [remote_name] [branch] • Branches are black magic for later  • There’s a big chance that the branch you are pushing to will be named “master”
  • 20. Recap ! Creating a repo • Create a repo $ git init • Add an remote $ git remote add origin [email protected]:UserName/ProjectName.git • Check if directory is a git repo $ ls –la Search for .git folder
  • 21. Recap ! The workflow. • Edit files and check the status $ git status • Add them to the staging area $ git add file1.php file2.php file3.php • Commit the changes $ git commit –m „Commit message that explains the changes‟ • Push them to Github $ git push origin master Enter passphrase! • Celebrate ! 
  • 22. DEMO 1) Create yourself a repo (from Github) 2) Add and Commit few files 3) Push them ! 4) Repeat 2) and 3) few times
  • 23. TAKE A BREAK. We all deserve it 
  • 24. Agenda • Why use Source Control System ? • How to setup Git and Github on Windows ? • Terminology • Repositories 1.0 – git {init, add, commit, push, remote} • Repositories 2.0 – .gitignore, git {clone, pull, revert, mv, rm} • Fork & Pull + Shared Repos
  • 25. Don’t push your passwords • Use .gitignore $ touch .gitignore $ echo “db_config.php” >> .gitignore $ git add .gitignore $ git push origin master Enter passphrase! • Something missing ? $ git commit –m „You are not seeing my passwords!‟
  • 26. Made a mistake ? No worries • Unstage something – git reset $ git add index.php $ git status Says it‟s staged. I don‟t want to ! I changed my mind. $ git reset HEAD – index.php $ git status Now I‟m happy ^_^ • Revert a commit ? Reset hard! $ git reset –hard HEAD~1 OR $ git reset –hard <commit_id>
  • 27. Fork time. • If you want to get a repo – fork is the way. • Fork on github and then $ git clone [email protected]:UserName/ProjectName.git • This inits a new Git repository! • You can do everything with the code now – this is a separate repository. • More @ http://help.github.com/fork-a-repo/
  • 28. Shared repos • If you are added as a collaborator @ some repo – you can do everything (clone, add, commit, push) without restrictions. • Shared repos mean more developers. More Developers = more changes. $ git pull [remote_name] • This will pull the latest changes 