Skip to main content

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
  1. Add your Git username and set your email

git config –-global user.name “YOUR_USERNAME”

  1. 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)

  1. Generate your SSH key

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

  1. Now let´s see your keygen

cat ~/.ssh/id_rsa.pub

  1. Copy your key

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

  1. 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
  1. 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

  1. To download the last copy from the repository

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

  1. To have a working copy of your repo

git merge (to have a working copy)

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

git commit -m ‘change you did’

  1. 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: