This is the P2PU Archive. If you want the current site, go to www.p2pu.org!

Reading Code

Office hours september 29th - Git and github

Pablo Olmos de Aguilera C.'s picture
Mon, 2010-09-27 23:30

Here is the log, please; feel free to add the beginning (I was a couple of minutes late).

sep 27 15:07:35 <eric-brechemier>    @natanatan there might be better GUIs but I haven't tried them
sep 27 15:07:49 <natanatan>    ok, got terminal window open, ready to dive in :)
sep 27 15:08:07 <PaBLoX>    Hi
sep 27 15:08:12 <eric-brechemier>    2) I'll help everyone to subscribe to Github, install Git if needed and create a SSH key pair
sep 27 15:08:13 <PaBLoX>    Sorry for being llate
sep 27 15:08:18 <eric-brechemier>    no pb
sep 27 15:08:25 <eric-brechemier>    we are just starting
sep 27 15:09:12 <eric-brechemier>    3) We'll start using Git, creating a repo on Github, running add, commit commands
sep 27 15:09:26 <natanatan>    how do you make a key?
sep 27 15:09:36 <PaBLoX>    what os are you?
sep 27 15:09:38 <eric-brechemier>    4) In the end, we'll dive into more advanced concepts, branching, merge, etc
sep 27 15:10:07 <eric-brechemier>    @natanatan we'll come to that in a short while
sep 27 15:10:19 <eric-brechemier>    So...
sep 27 15:10:22 <PaBLoX>    oh, ok; sorry =)
sep 27 15:10:44 <eric-brechemier>    Git is a distributed revision control system
sep 27 15:10:45 *    sometwothingsafk es ahora conocido como sometwothings
sep 27 15:11:15 <eric-brechemier>    It was started as a file system by Linus Torvalds who planned to lay the foundation for a revision control system
sep 27 15:11:28 <eric-brechemier>    then tools and utilities were added little by little
sep 27 15:11:39 <eric-brechemier>    and it grew into an actual revision control system
sep 27 15:12:11 <eric-brechemier>    It was designed to be different from (read better than) other revision control systems
sep 27 15:12:29 <eric-brechemier>    which were all seen as flawed: CVS, Subversion, ...
sep 27 15:12:30 *    mchua_afk es ahora conocido como mchua
sep 27 15:13:16 <eric-brechemier>    It shares a common goal: track changes in a set of files
sep 27 15:13:31 <eric-brechemier>    e.g. the history of the source code in an open source project
sep 27 15:13:45 <PaBLoX>    hm, can i interrupt you?
sep 27 15:13:50 <eric-brechemier>    Sure
sep 27 15:13:51 <PaBLoX>    to do a question?
sep 27 15:13:58 <PaBLoX>    Ok, so, git tracks changesets?
sep 27 15:14:00 <eric-brechemier>    Feel free to step in for questions at anytime :)
sep 27 15:14:09 <PaBLoX>    not like "snapshots"?
sep 27 15:14:27 <eric-brechemier>    There are various concepts in Git
sep 27 15:14:42 <eric-brechemier>    The history is a tree, with commits at each node
sep 27 15:14:52 <eric-brechemier>    a commit is a changeset
sep 27 15:15:03 <eric-brechemier>    with a description
sep 27 15:15:07 <eric-brechemier>    and a unique hash
sep 27 15:16:11 <eric-brechemier>    Greatest advantage of Git over CVS and Subversion: easy branching, powerful merge which avoids most conflicts, efficient storage, and...
sep 27 15:16:14 <eric-brechemier>    it is distributed
sep 27 15:16:15 <PaBLoX>    oh nice! I read somewhere that the main difference with mewrcurial (another version control system [VCS]) was that mercurial used changesets and git used snapshots - I guess that is wrong ;). Thanks =)
sep 27 15:16:40 <eric-brechemier>    For what I know, Mercurial and Git are similar.
sep 27 15:16:52 <PaBLoX>    okay! Thanks =)
sep 27 15:16:59 <eric-brechemier>    Now, there are probably differences in the way they handle things,
sep 27 15:17:11 <eric-brechemier>    and they probably use slightly different vocabulary for common concepts
sep 27 15:17:20 <natanatan>    So you can merge two forks from the same parent node?
sep 27 15:18:14 <eric-brechemier>    @natanatan I'm not sure to understand the question. We can get back to it later during hands on :)
sep 27 15:18:54 <eric-brechemier>    Distributed means that on every PC, server, ... you get a full copy of the full history of the project
sep 27 15:19:07 <eric-brechemier>    This is very handy when you work offline
sep 27 15:19:35 <eric-brechemier>    and it does not take more space than a Subversion repository, which has only the latest version
sep 27 15:20:07 <eric-brechemier>    I converted several repositories from Subversion to Git a couple of months ago, and saw a decrease of about 40% in size on disk
sep 27 15:20:20 <eric-brechemier>    They are clearly using an efficient compression scheme.
sep 27 15:20:47 <eric-brechemier>    The same holds true in exchanges between your local repository and a remote repository
sep 27 15:21:11 <eric-brechemier>    They communicate in deltas, exchanging only the differences
sep 27 15:21:30 <eric-brechemier>    You do not need a remote repository when using Git
sep 27 15:21:51 <eric-brechemier>    You can just create a local repository on your PC and start tracking changes
sep 27 15:22:06 <eric-brechemier>    it is a simple as running "git init" in a folder
sep 27 15:22:27 <PaBLoX>    I think it used less space because git tracks changesets, and svn tracks snapshots.
sep 27 15:22:29 <eric-brechemier>    That creates a hidden folder ".git", only at the root, which has all the metadata for Git
sep 27 15:22:55 <PaBLoX>    That explains also why merging and branching is easier in git/hg than svn/cvs
sep 27 15:23:26 <eric-brechemier>    @PaBLoX it definitely helps for merging, I don't know about compression
sep 27 15:23:45 <eric-brechemier>    For those of you interested, you may look for "3 way merge" for more details
sep 27 15:24:06 <eric-brechemier>    Now, even if you can work without a remote, it is useful to have one:
sep 27 15:24:08 <PaBLoX>    if you keep the whole file, more than once each one for each revision (svn/cvs)
sep 27 15:24:08 <eric-brechemier>    as a backup
sep 27 15:24:15 <eric-brechemier>    to share a project with others
sep 27 15:24:40 <PaBLoX>    its obviously uses way more space than files that keep the differences. Did I exaplin myself?
sep 27 15:24:47 <eric-brechemier>    Svn stored only differences for textual files, Git is probably much more efficient for different reasons as well :)
sep 27 15:24:56 <PaBLoX>    oh
sep 27 15:25:02 <PaBLoX>    Okay I'm wrong again then xD
sep 27 15:25:07 <PaBLoX>    :-#
sep 27 15:25:14 <eric-brechemier>    So, here comes GitHub
sep 27 15:25:28 <eric-brechemier>    this is the most popular host of opensource Git repositories
sep 27 15:25:55 <eric-brechemier>    and most projects can be found there
sep 27 15:26:14 <eric-brechemier>    one reason being that, even if the project is not hosted officially on GitHub,
sep 27 15:26:42 <eric-brechemier>    it is very easy to create an official Git repository for it anyway
sep 27 15:27:02 <eric-brechemier>    so you may find both official and unofficial clones of opensource project on GitHub
sep 27 15:27:20 <eric-brechemier>    There are also paid plans for private projects (not opensource)
sep 27 15:27:30 <eric-brechemier>    Any general questions on Git and GitHub?
sep 27 15:28:16 <eric-brechemier>    Cool :)
sep 27 15:28:21 <sometwothings>    :)
sep 27 15:28:46 <eric-brechemier>    Let's start the practical stuff
sep 27 15:28:54 <eric-brechemier>    Subscription to GitHub
sep 27 15:29:09 <eric-brechemier>    from the GitHub home page,
sep 27 15:29:28 <eric-brechemier>    Go to plans,
sep 27 15:29:29 <eric-brechemier>    http://github.com/plans
sep 27 15:29:49 <eric-brechemier>    then you can start to create a free account
sep 27 15:30:36 <eric-brechemier>    At this step, you need to choose a user name, a password, and provide an email address
sep 27 15:30:51 <eric-brechemier>    These will be used to connect to GitHub and manage your account and your repositories
sep 27 15:31:24 <eric-brechemier>    Git itself does not define authentication methods
sep 27 15:31:33 <eric-brechemier>    it relies on SSH for the security layer
sep 27 15:31:56 <PaBLoX>    (much better :P)
sep 27 15:32:01 <eric-brechemier>    SSH stands for secure shell
sep 27 15:32:19 <eric-brechemier>    you can connect to a remote server using ssh with a user name and password,
sep 27 15:32:30 <eric-brechemier>    but it is better to use a key
sep 27 15:32:52 <eric-brechemier>    that is a file with some encrypted-looking data,
sep 27 15:33:07 <eric-brechemier>    because then you don't need to type your password for each operation
sep 27 15:33:39 <eric-brechemier>    Who needs more help to create the GitHub account?
sep 27 15:34:43 <madarve>    Do you know any passphrase generator?, it seems the one i made is too short or easy to guess.
sep 27 15:34:51 <natanatan>    i made the account, but will need help making the when we get there
sep 27 15:35:04 <williamr>    madarve: http://strongpasswordgenerator.com/
sep 27 15:35:05 <eric-brechemier>    @natanatan sure
sep 27 15:35:05 <natanatan>    *key
sep 27 15:36:08 <eric-brechemier>    you can take your easy password and make it harder by adding punctuation marks, special characters, digits, lower and upper case letters
sep 27 15:36:27 <eric-brechemier>    if you have one of each and the password is 10-20 characters long you should be fine
sep 27 15:37:02 <eric-brechemier>    What are your user names on GitHub?
sep 27 15:37:23 <eric-brechemier>    http://github.com/eric-brechemier
sep 27 15:37:55 <rin_>    http://github.com/rin
sep 27 15:37:59 <madarve>    http://github.com/madarve
sep 27 15:38:15 <RaVexx>    http://github.com/ravexx
sep 27 15:38:30 <sometwothings>    http://github.com/sometwothings
sep 27 15:38:35 <PaBLoX>    http://github.com/PaBLoX-CL
sep 27 15:42:06 <eric-brechemier>    @williamr, @natanatan do you need help in creating the account?
sep 27 15:43:36 <eric-brechemier>    Feel free to ask for help
sep 27 15:43:56 <eric-brechemier>    In the meantime, we can install Git command line
sep 27 15:43:58 <natanatan>    i figured it out, thanks
sep 27 15:44:06 <eric-brechemier>    great :)
sep 27 15:44:21 <eric-brechemier>    There are instructions for each platform here:
sep 27 15:44:40 <eric-brechemier>    http://help.github.com/
sep 27 15:44:48 <natanatan>    http://github.com/natanatan
sep 27 15:45:13 <eric-brechemier>    On the right side, there are help topics
sep 27 15:45:38 <eric-brechemier>    Look for your platform and you will find the link to install Git command line
sep 27 15:45:59 <eric-brechemier>    http://help.github.com/linux-git-installation/
sep 27 15:46:14 <eric-brechemier>    http://help.github.com/mac-git-installation
sep 27 15:46:21 <eric-brechemier>    http://help.github.com/win-git-installation
sep 27 15:46:52 <eric-brechemier>    I will go step by step for the Windows install myself
sep 27 15:47:04 <eric-brechemier>    let me know if you have questions on any platform though
sep 27 15:47:33 <eric-brechemier>    On Windows, you need to download msysgit
sep 27 15:47:37 <eric-brechemier>    http://code.google.com/p/msysgit/
sep 27 15:48:16 <eric-brechemier>    In the download section, look for the latest Git-*-preview*.exe
sep 27 15:48:24 <eric-brechemier>    currently Git-1.7.2.3-preview20100911.exe
sep 27 15:48:52 <eric-brechemier>    I'm downloading the exe to my desktop
sep 27 15:49:08 <eric-brechemier>    and I start the setup
sep 27 15:50:15 <eric-brechemier>    I chose to change the installation folder
sep 27 15:50:43 <eric-brechemier>    I then selected only the quicklauch icon,
sep 27 15:51:48 <eric-brechemier>    then in Windows Explorer integration, I selected only (o) Git Bash Here
sep 27 15:52:08 <eric-brechemier>    I kept the other options unchanged
sep 27 15:52:36 <eric-brechemier>    I selected (o) Use Git Bash only
sep 27 15:53:00 <eric-brechemier>    Then there is one extra screen, which appears when you have Putty installed
sep 27 15:53:03 *    jessykate (~Adium@c-68-33-182-90.hsd1.dc.comcast.net) ha entrado en #p2pu-webcraft/reading-code
sep 27 15:53:38 <eric-brechemier>    You should choose (o) Use OpenSSH, not ( ) Use (Tortoise)Plink
sep 27 15:53:55 <eric-brechemier>    because OpenSSH is the only method supported by GitHub
sep 27 15:54:27 <PaBLoX>    welcome jessykate ;)
sep 27 15:55:04 <eric-brechemier>    I then select (o) Checkout as-is, commit as-is in the line ending configuration, because I don't like git to mess with my end of lines
sep 27 15:55:18 <eric-brechemier>    Hi Jessy
sep 27 15:55:34 <eric-brechemier>    Then the install starts
sep 27 15:55:48 <eric-brechemier>    Who needs help in setting up the Git command line?
sep 27 15:56:47 <eric-brechemier>    My installation was successful:
sep 27 15:57:01 <eric-brechemier>    I now have a Git Bash icon in the quick start section,
sep 27 15:57:19 <eric-brechemier>    and when I right click a folder, I have a Git Bash here option
sep 27 15:58:30 <eric-brechemier>    When you lanch the program in one of these ways, you get a Unix shell with Git and more
sep 27 15:59:09 <eric-brechemier>    The first thing you may want to check is the current location, which you can get by running
sep 27 15:59:10 <eric-brechemier>    pwd
sep 27 15:59:35 <eric-brechemier>    In my case,
sep 27 16:00:19 *    eric-brechemier se ha marchado (Quit: Page closed)
sep 27 16:00:28 <PaBLoX>    ;/
sep 27 16:00:50 *    eric-brechemier (52eaf5a6@gateway/web/freenode/ip.82.234.245.166) ha entrado en #p2pu-webcraft/reading-code
sep 27 16:00:55 <eric-brechemier>    sorry I got disconnected
sep 27 16:01:00 <eric-brechemier>    so running pwd
sep 27 16:01:16 <eric-brechemier>    "/c/Documents and Settings/Eric"
sep 27 16:01:32 <sometwothings>    how can I change this?
sep 27 16:01:34 <eric-brechemier>    that would be my home folder
sep 27 16:01:45 <eric-brechemier>    cd for change directory
sep 27 16:01:59 <eric-brechemier>    or from Windows, select the folder you want to start in
sep 27 16:02:02 <eric-brechemier>    right clic
sep 27 16:02:05 <eric-brechemier>    right-click
sep 27 16:02:19 <eric-brechemier>    and select Git bash here
sep 27 16:02:34 <sometwothings>    ok thx
sep 27 16:02:35 <eric-brechemier>    "/d/workspace"
sep 27 16:02:51 <eric-brechemier>    This is a Unix shell, so the path use "/", not "\"
sep 27 16:02:59 <eric-brechemier>    and it starts with /c, /d
sep 27 16:03:01 <eric-brechemier>    not c:, d:
sep 27 16:03:09 <sometwothings>    and can I configure Git to start in a folder of my choice by default?
sep 27 16:03:18 <sometwothings>    if not using the context menu
sep 27 16:03:30 <eric-brechemier>    I don't know.
sep 27 16:03:37 <eric-brechemier>    I usually right-click on the folder
sep 27 16:03:46 <sometwothings>    ok, thx
sep 27 16:04:01 <eric-brechemier>    now let's create your first local repository
sep 27 16:04:08 <eric-brechemier>    create a folder
sep 27 16:04:18 <eric-brechemier>    mkdir newproject
sep 27 16:04:34 <eric-brechemier>    then go to the new folder
sep 27 16:04:38 <eric-brechemier>    cd newproject
sep 27 16:04:41 <eric-brechemier>    and create repository
sep 27 16:04:44 <eric-brechemier>    git init
sep 27 16:05:07 <eric-brechemier>    Initialized empty Git repository in d:/workspace/newproject/.git/
sep 27 16:05:40 <eric-brechemier>    You can have a look at what git created by listing the contents of the .git folder
sep 27 16:05:45 <eric-brechemier>    ls .git
sep 27 16:06:19 <eric-brechemier>    you will not have to change anything in this folder manually (usually), but that's were Git commands modify things
sep 27 16:06:48 <eric-brechemier>    Let's do the same thing using GitHub
sep 27 16:06:53 <eric-brechemier>    Login to GitHub
sep 27 16:07:51 <eric-brechemier>    In the dashboard section, you can create a new repository
sep 27 16:08:10 <eric-brechemier>    http://github.com/repositories/new
sep 27 16:08:57 <eric-brechemier>    I just created one
sep 27 16:09:04 <eric-brechemier>    the description and URL are optional
sep 27 16:09:04 <eric-brechemier>    http://github.com/eric-brechemier/newproject
sep 27 16:09:37 <eric-brechemier>    Now we get a little more help from GitHub for the next steps
sep 27 16:10:09 <eric-brechemier>    On the project home page, you have first steps for a new repository
sep 27 16:10:26 <eric-brechemier>    Tell Git who you are
sep 27 16:10:33 <eric-brechemier>    using git config
sep 27 16:11:15 <eric-brechemier>    Add a first file to start the repository (you don't really have a repository until there is a first file, and Git cannot manage empty folders)
sep 27 16:11:47 <eric-brechemier>    There is a steap curve at this point...
sep 27 16:11:58 <eric-brechemier>    because it is very easy to get started from an existing project
sep 27 16:12:20 <eric-brechemier>    but it is somewhat more complex (and you need a different set of commands) to create a new repository yourself
sep 27 16:12:50 <eric-brechemier>    Getting someones repository is a easy as:
sep 27 16:13:56 <eric-brechemier>    git clone http://github.com/rails/rails.git master
sep 27 16:14:24 <eric-brechemier>    master is the name of the default branch
sep 27 16:14:34 <eric-brechemier>    that is the equivalent of the trunk in subversion
sep 27 16:14:57 <PaBLoX>    so,there's always a amaster?
sep 27 16:15:49 <eric-brechemier>    not initially
sep 27 16:15:55 <eric-brechemier>    you need to have at least one file
sep 27 16:16:04 <eric-brechemier>    you cannot clone an empty repository
sep 27 16:16:15 <eric-brechemier>    that's a real PITA
sep 27 16:16:32 <PaBLoX>    I mean
sep 27 16:16:40 <PaBLoX>    Every project has a master "branch" then
sep 27 16:16:59 <eric-brechemier>    yes
sep 27 16:17:09 *    mchua es ahora conocido como mchua_afk
sep 27 16:17:14 <eric-brechemier>    although technically, this may be just a convention
sep 27 16:17:24 <PaBLoX>    yup, that's what i imagined
sep 27 16:17:57 <eric-brechemier>    You may call your master branch anything (maybe) but that would be very ill-advised :)
sep 27 16:18:04 <PaBLoX>    hahaha
sep 27 16:18:04 <natanatan>    should each clone be made in a seperate repository folder?
sep 27 16:18:36 <eric-brechemier>    typically, you choose a workspace folder
sep 27 16:18:48 <eric-brechemier>    and you clone all projects at the same level in the workspace
sep 27 16:19:11 <eric-brechemier>    it is better not to clone a repository inside another repository
sep 27 16:19:18 <natanatan>    so ruby, django, and wordpress clones could all go into the workspace folder?
sep 27 16:19:23 <eric-brechemier>    yes
sep 27 16:19:56 <natanatan>    not in thier own folders (workspace/ruby, workspace/wordpress)?
sep 27 16:20:17 <eric-brechemier>    When you clone a project, git creates a folder named after the project
sep 27 16:20:25 <eric-brechemier>    so you actually end up with workspace/rails, etc...
sep 27 16:20:29 <natanatan>    ahh thats a cool feature
sep 27 16:20:52 <eric-brechemier>    you can choose a different name (but why would you :) )
sep 27 16:21:28 <eric-brechemier>    Now let's tell Git who you are
sep 27 16:21:48 <eric-brechemier>    git config --global user.name "Eric Bréchemier"
sep 27 16:21:55 <eric-brechemier>    git config --global user.email github@eric.brechemier.name
sep 27 16:22:26 <eric-brechemier>    Quick note,
sep 27 16:22:39 <eric-brechemier>    the shell does not like accented letters that much
sep 27 16:23:08 <PaBLoX>    what about the second command?
sep 27 16:23:25 <eric-brechemier>    git config sets configuration options
sep 27 16:23:38 <eric-brechemier>    the --global flag stores the option globally (for all repositories)
sep 27 16:23:52 <eric-brechemier>    there are two "fields", user.name and user.email
sep 27 16:24:02 <eric-brechemier>    each command sets a value for the corresponding field
sep 27 16:24:18 <eric-brechemier>    there are lots of other options, but there are the only really required ones
sep 27 16:24:31 <PaBLoX>    yup i get
sep 27 16:24:35 <PaBLoX>    im just curious
sep 27 16:24:37 <eric-brechemier>    You can get help on all git commands in two ways
sep 27 16:24:43 <eric-brechemier>    git help command
sep 27 16:24:43 <PaBLoX>    about yhe github@eric...
sep 27 16:24:46 <eric-brechemier>    e.g.
sep 27 16:24:52 <eric-brechemier>    git help config
sep 27 16:24:57 <eric-brechemier>    or with man
sep 27 16:25:00 <eric-brechemier>    man git-config
sep 27 16:26:00 <eric-brechemier>    Only the first one is supported on msysgit
sep 27 16:26:06 <PaBLoX>     i mean something like that it's necessary to make ii work with github?
sep 27 16:26:33 <eric-brechemier>    It is useful yes, to identify who made a commit
sep 27 16:26:49 <eric-brechemier>    that's how you get the name and profile of each committer
sep 27 16:27:21 <eric-brechemier>    name and contact
sep 27 16:27:44 <eric-brechemier>    Because Git is distributed, I can push to GitHub a full project's history
sep 27 16:27:53 <eric-brechemier>    that does not mean that I am the author of the whole project :)
sep 27 16:28:52 <PaBLoX>    but I've to do something like that so i can use git hub?
sep 27 16:28:53 <PaBLoX>    i mean
sep 27 16:29:11 <PaBLoX>     git config --global user.email github@asfdasffas.name
sep 27 16:29:12 <PaBLoX>    ?
sep 27 16:29:20 <PaBLoX>    Or that was your move only?
sep 27 16:29:28 <eric-brechemier>    yes, to identify your commits
sep 27 16:29:37 <eric-brechemier>    (of course replace with your name and email :) )
sep 27 16:30:30 <eric-brechemier>    You should try to create a project on GitHub, then you get more instructions on the go
sep 27 16:30:39 <eric-brechemier>    from the new project page
sep 27 16:30:45 <natanatan>    i ran the line you posted for rails
sep 27 16:31:01 <natanatan>    but instead od a rail folder i have a "master" folder - is that correct?
sep 27 16:31:24 <eric-brechemier>    oops
sep 27 16:31:31 <eric-brechemier>    my bad probably, let me check
sep 27 16:32:18 <eric-brechemier>    you don't need the master part, it is implied
sep 27 16:32:34 <eric-brechemier>    git clone http://github.com/rails/rails.git
sep 27 16:32:36 <eric-brechemier>    is enough
sep 27 16:32:43 <eric-brechemier>    the extra argument is the folder name
sep 27 16:33:04 <natanatan>    ok
sep 27 16:33:05 <eric-brechemier>    there are many commands that need the branch name explicitly though
sep 27 16:33:24 <eric-brechemier>    you can rename the folder
sep 27 16:33:30 <eric-brechemier>    and move it somewhere else
sep 27 16:33:37 <eric-brechemier>    as long as you keep the .git folder within
sep 27 16:33:41 <eric-brechemier>    there is no problem
sep 27 16:34:02 <eric-brechemier>    just did it:
sep 27 16:34:05 <eric-brechemier>    mv master rails
sep 27 16:34:49 <eric-brechemier>    @PaBLoX do you need to help to create a first project on GitHub, using the dashboard?
sep 27 16:35:15 <eric-brechemier>    For those who habe not done it yet, create a file in your new local repository
sep 27 16:35:27 <eric-brechemier>    you can do it using the command line,
sep 27 16:35:47 <PaBLoX>    eric-brechemier, no, I just was curious about that email github@my.name.name
sep 27 16:36:02 <eric-brechemier>    or use a text editor by going to the same folder and using the editor of your choice
sep 27 16:36:10 <eric-brechemier>    @PaBLoX ok
sep 27 16:36:32 <eric-brechemier>    I go to D:\workspace\newproject
sep 27 16:36:44 <eric-brechemier>    I create a new file in Windows explorer
sep 27 16:37:25 <eric-brechemier>    I saved a README.txt file with a description
sep 27 16:38:01 <eric-brechemier>    GitHub will use README files at the root of the repository to display the project description on the project web page
sep 27 16:38:10 <eric-brechemier>    (the full description)
sep 27 16:38:32 <eric-brechemier>    I get back to the shell
sep 27 16:38:44 <eric-brechemier>    ls
sep 27 16:38:44 *    rin_ se ha marchado (Quit: Page closed)
sep 27 16:38:48 <eric-brechemier>    README.txt
sep 27 16:38:52 <eric-brechemier>    git status
sep 27 16:38:59 <eric-brechemier>    that is the most useful git command
sep 27 16:39:13 <eric-brechemier>    I run it all the time, to check where I'm at
sep 27 16:39:39 <eric-brechemier>    It tells you about ongoing changes, and suggest commands
sep 27 16:40:06 <eric-brechemier>    Very important concept:
sep 27 16:40:39 <eric-brechemier>    there are different steps for your files, like different steps in a staircase
sep 27 16:40:46 <eric-brechemier>    or like a stage in a concert hall
sep 27 16:41:17 <eric-brechemier>    when you create a file, or when you modify an existing file, it is a the level 0
sep 27 16:41:42 <eric-brechemier>    you need to put it on stage to prepare it for the next commit
sep 27 16:42:01 <eric-brechemier>    you move files from level 0 to level 1 (the stage), by using git add
sep 27 16:42:26 <eric-brechemier>    here git add README.txt selects the file for the next commit
sep 27 16:43:04 <eric-brechemier>    Now git status tells me that README.txt is at the next level, in "Changes to be committed"
sep 27 16:43:16 <eric-brechemier>    I can still modify the file
sep 27 16:43:48 <eric-brechemier>    I just did, and saved the file
sep 27 16:43:57 <eric-brechemier>    It is now at two levels at the same time:
sep 27 16:44:18 <eric-brechemier>    the initial version of the file is at level 1
sep 27 16:44:24 <eric-brechemier>    the new changes are at level 0
sep 27 16:44:35 <eric-brechemier>    I can now commit only the initial version
sep 27 16:44:39 <eric-brechemier>    or add more changes
sep 27 16:44:41 <eric-brechemier>    I'll do that
sep 27 16:44:45 <eric-brechemier>    git add README.txt
sep 27 16:45:14 <eric-brechemier>    Now the README.txt is all back at level 1
sep 27 16:45:22 <eric-brechemier>    Let's commit
sep 27 16:45:23 <eric-brechemier>    git commit
sep 27 16:45:37 <eric-brechemier>    I enter a text editor to input a description
sep 27 16:45:53 <eric-brechemier>    The actual editor depends on the platform, here it is a vim variant
sep 27 16:46:22 <eric-brechemier>    You need to type i to enter edit mode
sep 27 16:46:28 <eric-brechemier>    and type your comment
sep 27 16:46:44 <eric-brechemier>    Writing a git comment is like writing a mail to your future self
sep 27 16:46:51 <eric-brechemier>    by convention, the first line should be a title
sep 27 16:46:55 <eric-brechemier>    then let one empty line
sep 27 16:47:07 <eric-brechemier>    then type the body of the message, with a longer description
sep 27 16:47:19 <eric-brechemier>    (you don't need to sign, you already did by using git config)
sep 27 16:47:33 <eric-brechemier>    Questions?
sep 27 16:48:07 <sometwothings>    what next? :)
sep 27 16:48:24 <eric-brechemier>    To save the file (if the editor is vim), escape
sep 27 16:48:34 <eric-brechemier>    you get back to command mode
sep 27 16:48:46 <eric-brechemier>    then write file and quit
sep 27 16:48:48 <eric-brechemier>    :wq
sep 27 16:49:21 <eric-brechemier>    You should now have a first commit
sep 27 16:49:24 <eric-brechemier>    check with git log
sep 27 16:49:44 <eric-brechemier>    Author: Eric BRECHEMIER <github@eric.brechemier.name> Date:   Mon Sep 27 22:44:53 2010 +0200      Initial commit      I added a readme file by using git add and git commit.
sep 27 16:49:53 <eric-brechemier>    Author: Eric BRECHEMIER <github@eric.brechemier.name>
sep 27 16:50:00 <eric-brechemier>    Date:   Mon Sep 27 22:44:53 2010 +0200
sep 27 16:50:06 <eric-brechemier>    Initial commit
sep 27 16:50:14 <eric-brechemier>    I added a readme file by using git add and git commit.
sep 27 16:50:19 <eric-brechemier>    ---
sep 27 16:50:26 <eric-brechemier>    It looks like a mail message
sep 27 16:50:37 <eric-brechemier>    with the commit identifier on top
sep 27 16:50:48 <eric-brechemier>    commit afc3babc641883318d26b6bb95b24f30bce051fa
sep 27 16:50:59 <eric-brechemier>    that's the identifier: afc3babc641883318d26b6bb95b24f30bce051fa
sep 27 16:51:18 <natanatan>    i gotta take care of some things right now, thanks Eric, for gittin me on github. Ill keep keep window open to read chat later. Ciao everybody!
sep 27 16:51:26 <eric-brechemier>    ciao
sep 27 16:51:39 <eric-brechemier>    I understand that it's running late
sep 27 16:51:48 <eric-brechemier>    sorry that it is taking so long :)
sep 27 16:51:54 <sometwothings>    bye!
sep 27 16:52:16 <madarve>    <eric-brechemier>, it's ok thanks for taking the time
sep 27 16:53:09 <eric-brechemier>    We may plan another session for advanced usage if people are still interested
sep 27 16:53:28 <eric-brechemier>    today i'll just finish with basic use and creating the key
sep 27 16:53:46 <sometwothings>    okay
sep 27 16:54:13 <eric-brechemier>    Now, we have a git repository, but only locally
sep 27 16:54:22 <eric-brechemier>    be want to share it with the World on GitHub
sep 27 16:54:53 <eric-brechemier>    there are two basic commands to sync repositories
sep 27 16:54:55 <eric-brechemier>    git push
sep 27 16:54:56 <eric-brechemier>    git pull
sep 27 16:55:13 <eric-brechemier>    git push
sep 27 16:55:19 <eric-brechemier>    results in
sep 27 16:55:33 <eric-brechemier>    fatal: No destination configured to push to.
sep 27 16:56:52 <eric-brechemier>    but before you can push to GitHub, you need to configure the SSH keys
sep 27 16:57:15 <eric-brechemier>    Go to Account Settings
sep 27 16:57:24 <eric-brechemier>    SSH public keys
sep 27 16:57:48 <eric-brechemier>    A key is made of two parts
sep 27 16:57:56 <eric-brechemier>    a private part that you keep on your computer
sep 27 16:58:26 <eric-brechemier>    and a public part that you cut and paste in the form to add a new key which identifies you on this computer
sep 27 16:58:54 <eric-brechemier>    It is good practice to use a separate key for each machine, e.g. on for your laptop and one for your desktop
sep 27 16:59:02 <madarve>    Do the repo's i've forked in github automatically sync with their "original" ones?
sep 27 16:59:03 <eric-brechemier>    you can add several public keys to GitHub
sep 27 16:59:15 <eric-brechemier>    no, you have to call git pull to sync
sep 27 16:59:30 <eric-brechemier>    then yes :)
sep 27 16:59:48 <eric-brechemier>    I mean it is not automatic
sep 27 16:59:55 <madarve>    If i call git pull it will update my local repo (the one on my machine).
sep 27 17:00:00 <eric-brechemier>    yes
sep 27 17:00:20 <eric-brechemier>    except you need to provide extra arguments
sep 27 17:00:25 <madarve>    But what about the repos i've forked on github.
sep 27 17:00:46 <madarve>    Let's say i fork ruby on rails
sep 27 17:00:54 <eric-brechemier>    when you clone a repository, it gets automatically an alias
sep 27 17:00:57 <eric-brechemier>    it is "origin"
sep 27 17:01:13 <eric-brechemier>    then you need to specify the branch you want to sync, e.g. "master"
sep 27 17:01:15 <eric-brechemier>    that makes
sep 27 17:01:18 <eric-brechemier>    git pull origin master
sep 27 17:02:27 <eric-brechemier>    And there was a new commit in rails just 2 minutes ago :)
sep 27 17:03:37 <eric-brechemier>    Here is the guide to create a new key
sep 27 17:03:37 <eric-brechemier>    http://help.github.com/msysgit-key-setup/
sep 27 17:05:23 <eric-brechemier>    Once you have created and added the key to GitHub, you will be allowed to push to the repositories that you create in this account, or that are shared with you
sep 27 17:06:36 <eric-brechemier>    ssh-keygen -t rsa -C "key on eric's laptop for GitHub"
sep 27 17:06:48 <eric-brechemier>    will generate the key
sep 27 17:07:30 <eric-brechemier>    you need to create a .ssh folder in your home directory
sep 27 17:07:37 <eric-brechemier>    then run the command
sep 27 17:07:57 <eric-brechemier>    you may optionally provide a passphrase for extra security (this is not required)
sep 27 17:08:38 <eric-brechemier>    the private key is id_rsa
sep 27 17:08:45 <eric-brechemier>    the public key is id_rsa.pub
sep 27 17:08:52 <eric-brechemier>    (two files in ~/.ssh)
sep 27 17:09:03 <eric-brechemier>    you can display the contents of id_rsa.pub
sep 27 17:09:07 <eric-brechemier>    cat id_rsa.pub
sep 27 17:09:30 <eric-brechemier>    then cut and paste to the add new key form on GitHub
sep 27 17:10:12 <eric-brechemier>    ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw+zZ/rhJwrecBv12pwffteV+2Wn6EphopOfLPjehqnqz TTUhJg9WUbaI41TQnZcrTFAfYJhozMfKEqpbdUfaP/aIVwVz/ikoh0pYwZU61MTt10J/97NqBO6sCmdO tVp565PzlzwnFeeUCOLjSZke/pPFqckU3dCBlud4RiI3iP7x6wzAFaPafGdsgzYWMrTCFpa5zXBCvuaz 8Y+vc1oW4uGu3J4lJBzUCAp6m6lf66M/9En9vb6n+gy2v/tVlLQLRzZElFQba+lVll4PW7agvvV2TkaO IGPg6VwIe38tVRjLqt2gUECs3i0zRaSqHWE21DE9HWHn0FHSeJYW8+mY2Q== eric-brechemier@git hub
sep 27 17:10:26 <eric-brechemier>    this is my public key
sep 27 17:11:01 <eric-brechemier>    When you create a new repository, there is no "origin" by default
sep 27 17:11:12 <eric-brechemier>    you need to specify it
sep 27 17:12:02 <eric-brechemier>    You will find the private URL to access your project with Read-Write access on the project home page,
sep 27 17:12:03 <eric-brechemier>    e.g.
sep 27 17:12:06 <eric-brechemier>    git@github.com:eric-brechemier/newproject.git
sep 27 17:12:28 <eric-brechemier>    to configure it, from within the repository, run
sep 27 17:12:46 <eric-brechemier>    git remote add origin git@github.com:eric-brechemier/newproject.git
sep 27 17:13:09 <eric-brechemier>    you are then allowed to push to create the master branch and initialize the repo
sep 27 17:13:16 <eric-brechemier>    git push origin master
sep 27 17:14:30 <eric-brechemier>    From this point, you can use the same commands as for a repository that you have cloned
sep 27 17:15:09 <eric-brechemier>    When you clone someone's repository on GitHub, you typically don't have Read+Write access to their repository
sep 27 17:15:14 <eric-brechemier>    unless they are sharing it with you
sep 27 17:15:49 <eric-brechemier>    It is fine to create your own fork, to have Read+Write access
sep 27 17:16:01 <eric-brechemier>    you can do it from the project page on GitHub
sep 27 17:16:16 <eric-brechemier>    a new repository is then added in your account, which is a remote clone of the project
sep 27 17:16:59 <eric-brechemier>    I'll take a last round of questions and we can follow up by email at p2pu@eric.brechemier .name :)
sep 27 17:17:44 <eric-brechemier>    p2pu@eric.brechemier.name
sep 27 17:21:38 <sometwothings>    great, thx!
sep 27 17:21:46 <sometwothings>    everything worked up till now
sep 27 17:21:47 <sometwothings>    :)
sep 27 17:21:57 <eric-brechemier>    cool :)
sep 27 17:22:36 <eric-brechemier>    Feel free to mail me if you encounter issues at some point :)
sep 27 17:22:52 <eric-brechemier>    Good Night / Good Day to you all
sep 27 17:23:09 <madarve>    THanks eric.
sep 27 17:23:33 <sometwothings>    :) gn8 thx again!
sep 27 17:23:36 <PaBLoX>    bye!
sep 27 17:24:00 *    sometwothings se ha marchado (Quit: Page closed)
sep 27 17:24:09 *    eric-brechemier_ (52eaf5a6@gateway/web/freenode/ip.82.234.245.166) ha entrado en #p2pu-webcraft/reading-code
sep 27 17:24:30 <RaVexx>    thx and bye all
sep 27 17:24:55 <eric-brechemier_>    @jessykate, my chat crashed a couple of times during the session, but I hope someone can provide the log :)
sep 27 17:25:03 <eric-brechemier_>    Cheers
sep 27 17:25:31 *    eric-brechemier_ se ha marchado (Client Quit)

Comments

since I wasn't there at the

Rin Raeuber's picture
Rin Raeuber
Tue, 2010-09-28 06:52

since I wasn't there at the end to say thanks: thanks Eric and everybody!