Post

Git & GitHub SSH Setup

Git

Git is an opensource version control system used to track changes in files. It’s a powerful tool allowing multiple developers to work efficiently on a single code-base.

Cheatsheet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Setup
git init
git add .
git clone https://git@repositoryUrl

#Getting Ready
git pull
git push
git status
git fetch
git remote prune origin #Remove branch from local that's not in remote anymore

#Working
git log
git commit -m "my first commit"
git diff # Changed but not staged
git diff --staged # Staged but not committed
git reset fileName # Unstage

#Branch
git branch branchName
git checkout branchName
git merge branchName
git rebase branchName 
git reset --hard commit

#Temp
git stash
git stash list
git stash pop
git stash drop

GitHub SSH Setup

It’s a dev platform utilizing git for distributed version control. The best way to use github is by setting it up via ssh.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#If no password is needed, press enter on prompts
ls -al ~/.ssh
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"

#Paste the following in config
#touch ~/.ssh/config
#Host github.com
#  AddKeysToAgent yes
#  UseKeychain yes
#  IdentityFile ~/.ssh/id_ed25519
#ssh-add --apple-use-keychain ~/.ssh/id_ed25519

pbcopy < ~/.ssh/id_ed25519.pub

Open Github > Settings > SSH and GPG Keys > New SSH Key and paste the public key. To verif the ssh connection use the following cmd ssh -T [email protected]

This post is licensed under CC BY 4.0 by the author.