How To Backup Your Git Repository To GitHub

Command Summary

List of commands from video demo:

# view current state of your repo
git status 

# initialize a brand new repo
git init

# set global setting
git config --global user.name "Ray"
git config --global user.email "ray@github.com"

# view global settings
git config --global user.name
git config --global user.email

# stage all files
git add *

# quickly commit staged files
git commit -m "<Commit Message>"

# view all of your commits
git log

# view all remote branches
# you are tracking
git remote -v

# add a remote branch using HTTPS protocol
git remote add origin https://github.com/linuxblogger150/scripts.git

# push TO remote repo 'origin', our
# remote branch 'master'
git push origin master

# create keypair 
# '/home/rlc/.ssh/github' and 
# '/home/rlc/.ssh/github.pub'
ssh-keygen

# cat public key
cat /home/rlc/.ssh/github.pub

# test SSH authentication to 
# Github.com
ssh -T git@github.com

# view ALL loaded keys
ssh-add -l

# spawn a new "agent process"
eval "$(ssh-agent -s)"

# add our custom key
ssh-add ~/.ssh/github

# UPDATE origin's URL to SSH
git remote set-url origin git@github.com:linuxblogger150/scripts.git


Video Demo

Leave a comment