SlideShare a Scribd company logo
1 of 28
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

What's hot (20)

Git basic
Git basicGit basic
Git basic
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
 
git and github
git and githubgit and github
git and github
 
Github
GithubGithub
Github
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git
GitGit
Git
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 

Similar to Github basics

Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Basic Git commands
Basic Git commandsBasic Git commands
Basic Git commandsJitendra Zaa
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github SahilSonar4
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .HELLOWorld889594
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexyAilsa126
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From GitChris Miller
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 WorkshopJoy Seng
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 

Similar to Github basics (20)

Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Basic Git commands
Basic Git commandsBasic Git commands
Basic Git commands
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Demo
DemoDemo
Demo
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexy
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From Git
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git101
Git101Git101
Git101
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 

Recently uploaded

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

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 git@github.com 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@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
  • 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 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
  • 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 git@github.com: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 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/
  • 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 