Subscribe to NotarySojac's debian career        RSS Feed

Day 4 - Why git will replace incumbant president Barack Obama in the 2012 democratic primaries

Icon Leave Comment
Well... now that we're coding and compiling on this thing, we'd better come up with some way of tracking the history and progress of our source code.
I mean... one false line of code and we might destroy our entire application, and we don't even know how to make backup copies. Hmmm... what to do... I know!


Oh, it looks like it's not installed, git: the version control software that allows you to work on source code with large groups of people with out having to worry about stepping on anybodies toes or the constant addling of a dense central control system.
The git philosophy is to no longer be reliant on a central server and instead, shift version control to be a more distributive, separable environment.

Awesome, some nerdy kid tells us about how perfect it is via youtube!

:: Install git on debian

Well, let's follow the below tutorial and make comments on how things went.

reference tut (install and use git):

That first part of his series was amazing! What a good tutorialist.

Here's the summary:
apt-get install git-core

But, when you turn the page, he does things wrong =( He starts talking about apache server. We don't want anything to do with that technology, so we'll need to look elsewhere.

reference tut (install html interface for git):

Looks like this guy wants us to install another database engine along side mysql and do a whole bunch of crap... Let's put this off till another day. I want to dive into how git works, and that means we need to work on our project on a public git server.

:: Install git on windows (optional)
Before we jump into a server, let's get our windows machine situated with git. I love working on my PHP script with my windows laptop. I don't know why.

(just DL the beta, they really are needy at git for some reason)

:: github is a website that lets you share your git repositories on the web. It handles extra cool features like "pull requests" and stuff, that help make sharing code fun and easy.

Let's start a repository on github!
Below is a good video, but it's slightly out dated. Follow along with him until you get the error.

He has you do the following pretty much (in a directory you'd like to post to github):

(setup your git name and email on your computer)
$  git config --global "Your Name"
$  git config --global [email protected]
$  git config --list

(initialize the git repo)
$  git init   // start a new git repository in this directory (it makes a .git folder)

$  git add .  // add all files in the directory to your newly created git repository

$  git commit -m "initial commit"  // actually commit those changes to your git repo

Then he has you setup your github and click the "create new repo" button which should be on your 'Dashboard'. Following that, you are to add the remote information to your git repo.
$  git remote add origin [email protected]:YourGitHubAccount/YourAppName.git

That command creates a new 'remote' named origin. Some helpful commands related to this follow:
$  git remote show
$  git remote rename <old name> <new>
$  git remote rm <name of remote to delete>

After that's all good to go, you can go ahead and push to your newly created remote repository:
$  git push -u origin master

... OK, the error you received was probably
$  git push -u origin master
Permission denied (publickey).
fatal:  The remote end hung up unexpectedly

That problem is easily remedied, just perform the following steps.
ref (optional): (see the "setup ssh" section)

1) Remove any old keys in the .ssh directory so you can add a new key.
$  cd ~/.ssh
$  rm id_rsa*

2) Add a new key that is built, based on your email at github.
$  ssh-keygen -t rsa -C "[email protected]"
<hit enter>
<input an optional pass phrase>

Copy the key and paste it into your github account's "SSH public Keys" section on the website.
$  cat ~/.ssh/
<copy the whole line/ multi-line>

After that, you should be able to follow along with the guy's excellent video tutorial if the way is not yet clear for you. I got bored at about 7:45, and moved onto writing the second part of this tutorial.

Want to see more git?

0 Comments On This Entry


Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry