Git Workshop

Preview:

DESCRIPTION

A workshop for installing git, initializing and comitting to a repository, and pushing the repository to github.com.

Citation preview

git workshop

ABOUT ME

Alex YorkConsultant

www.alexyork.net@alex_york

“You stupid git!”

msysgit

http://code.google.com/p/msysgit/

Git client for Windows

Installing msysgit (1)

Installing msysgit (2)

Installing msysgit (3)

Installing msysgit (4)

Open “Git Bash”

Names with Æ Ø Å

• Add an environment variable for HOME– So that git will not look in:– C:\Users\Follesø

• Right click on My Computer• Advanced System Settings• Environment Variables• Add

Names with Æ Ø Å

Names with Æ Ø Å

Names with Æ Ø Å

First git command: check version

git --version

Configure your email

git config --global user.email alex-york@hotmail.co.uk

Configure your name

git config --global user.name “Alex York”

Generate SSH keys

ssh-keygen –C  “alex-york@hotmail.co.uk”  –t rsa

That C is UPPERCAS

E!

Generating SSH keys

Press Enter/Return when prompted for file location and your passphrase.

Generated SSH keys

The public key will be used later on github.com.Pro tip: make backups of these keys!

Write some code!

Navigating with Git Bash

cd /c/Code/NNUG-Hello-World/

Initializing a repository

git init

What just happened?

View current status

git status

Creating a .gitignore file

touch .gitignore

View current status

git status

Add to staging area

git add .

Add to staging area

Next: commit

• After adding (and removing?) several times to the staging area...

• ... commit to the repository

• committing is like a snapshot of your code

Committing to repository

git commit –m “Commit message goes here”

Committing to repository

Commit log

git log

github.com

SSH Public Key

New Repository (1)

New Repository (2)

You’ve created a github repo!

Add your remote repository

git remote add origin git@github.com:alexyork/NNUG-Hello-World.git

All on one line!

Push to your remote repo

git push origin master

github.com

What next?

• Find something cool on github– git clone git@github.com/whatever

• Fork something– Add a feature, fix a bug– Create a pull request

• Start up an open-source project!

Based on this guide

• Git For Windows Developers by Jason Meridth

• http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for-windows-developers-git-series-part-1.aspx

• These slides available at: www.alexyork.net

Recommended