Github Boilerplate for New Repositories

Create a new repository on the command line

echo "# github-new-repo-template" >>
git init
git add
git commit -m "first commit"
git branch -M main
git remote add origin
git push -u origin main

Push an existing repository from the command line

git remote add origin
git branch -M main
git push -u origin main

How to use a personal access token from the command line

Simply user your Github username and for password, the actual token.

Set up an existing directory to pull from Git

git init
git remote add origin
git pull origin main

Cheat Sheet

Start a main branch by default (requires Git 2.28):

git config --global init.defaultBranch main

Upgrade Git

On a new Ubuntu, you might get this:

sudo apt-get upgrade git
git is already the newest version (1:2.25.1-1ubuntu3.1).


sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version



Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top