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)
Install Git
- GitBash for windows users Gitbash
- Open command line for MacOSX user(Git is usually preinstalled on Mac and Linux.) command line
Add your Git username and set your email
git config –-global user.name “YOUR_USERNAME”
Configure you email address for uploading
git config -–global user.email “jSmith@mail.com”
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)
Generate your SSH key
ssh-keygen -t rsa -C "$your_email"
Now let´s see your keygen
cat ~/.ssh/id_rsa.pub
Copy your key
Windows: clip < ~/.ssh/id_rsa.pub Mac:pbcopy < ~/.ssh/id_rsa.pub Linux xclip -sel clip < ~/.ssh/id_rsa.pub
Finally add the copied key to GIT on the web version
COPY YOUR ACADEMY PERSONAL REPO.
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
Clone your student repository
git clone git@git.fabacademy.org:fabacademy2017/yourlabname/yourstudentnumber.git
UPLOAD YOUR REPO ONLINE.
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 onceTo download the last copy from the repository
git pull (for downloading the last copy of the repository)
To have a working copy of your repo
git merge (to have a working copy)
Now name your update, so you know what you changed with this push.
git commit -m ‘change you did’
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
Original tutorial by:
- Eduardo Chamorro, Fab Lab Barcelona 01.2019