GIT SIMPLE CHEAT SHEET

Fast guide to upload and update your repo to the GIT repo of Fab Academy


SETUP GIT (to do only the first time)

  1. Install Git

    • GitBash for windows users Gitbash
    • Open command line for MacOSX user(Git is usually preinstalled on Mac and Linux.) command line
  2. Add your Git username and set your email

    git config –-global user.name “YOUR_USERNAME”

  3. Configure you email address for uploading

    git config -–global user.email “jSmith@mail.com”

  1. Check if you have an SSH KEY already

    cat ~/.ssh/id_rsa.pub (If you see a long string starting with ssh-rsa, you can skip the ssh-keygen step)

  2. Generate your SSH key

    ssh-keygen -t rsa -C "$your_email"

  3. Now let´s see your keygen

    cat ~/.ssh/id_rsa.pub

  4. Copy your key

    Windows: clip < ~/.ssh/id_rsa.pub Mac:pbcopy < ~/.ssh/id_rsa.pub Linux xclip -sel clip < ~/.ssh/id_rsa.pub

  5. Finally add the copied key to GIT on the web version

Video on how to do it

COPY YOUR ACADEMY PERSONAL REPO.

  1. Navigate to the folder where you want to put or create your repo. If you don´t know how to follow this guide

    • We recommend to create it in the desktop so you don´t have to dive into million of folders each time
  2. Clone your student repository

    git clone git@git.fabacademy.org:fabacademy2017/yourlabname/yourstudentnumber.git

UPLOAD YOUR REPO ONLINE.

  1. Add the new files you added to git

    git add index.html to upload file by file
    git add . to upload all the files at once

  2. To download the last copy from the repository

    git pull (for downloading the last copy of the repository)

  3. To have a working copy of your repo

    git merge (to have a working copy)

  4. Now name your update, so you know what you changed with this push.

    git commit -m ‘change you did’

  5. Upload to the Repository

    git push

Other commands used frecuently

git rm (in case you need to remove a tracked file)

git mv move or rename a file ,a directory or a symlinkgit

git status to see what changed

Terminal commands you will use to get to your archive folder

dir To view the contents of a directory, type "dir"

ls To view the files as a list

cd It is frequently useful to know in which directory you are currently working To move between directories, use the cd command with the name of a directory example go to desktop is "cd Desktop"

mkdir To create a new directory

del Subsequently, you might want to clean up useless files

Capital letters matter here


PROBLEMS

  • Run to the extended GIT CHEAT SHEET TUTORIAL
  • Official git guide

Original tutorial by: