Create a new repository

git init
echo "# MESSAGE" >>
git add
git commit -m "first commit"

To a add a new remote

git remote add origin

To change the url of an existing remote repository

git remote set-url origin
git push -u origin master

push your code to the master branch of the remote repository defined with origin and -u let you point your current local branch to the remote master branch

Common git command

git add . add all the changes/modifications to staging area
git commit -m"your comment" will commit the changes with your comment
git push master origin
git push is used to push local commits (changes) to master branch of origin

git pull is used to sync down changes to local git repo

git clone URL is used to clone/download git repo to local

Proxy config

git config --global http.proxy http://username:password@ipaddress:port

Large files

Download and install the Git command line extension. You only have to set up Git LFS once. git lfs install

Select the file types you’d like Git LFS to manage (or directly edit your .gitattributes). You can configure additional file extensions at anytime.

git lfs track "*.psd"
git lfs track "*.mat"

Make sure .gitattributes is tracked

git add .gitattributes
git large files

Recover files

Recover file form local .git

git reset HEAD \*
git checkout -- .

Reset local git

git reset
git checkout .
git clean -fdx

setup local account

Open Git Bash. Paste the text below, substituting in your GitHub email address.

ssh-keygen -t rsa -b 4096 -C ""

This creates a new ssh key, using the provided email as a label. Generating public/private rsa key pair.
When you’re prompted to “Enter a file in which to save the key,” [press Enter]. This accepts the default file location.
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]

Local password

At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/*_rsa
clip < ~/.ssh/

Now the generated ssh key is on the clipboard paste it on the

SSH configuration on linux (linuxmint tested)

sudo apt-get install xclip corkscrew

add line to ~/.ssh/ssh_config

    ProxyCommand corkscrew proxyaddress proxyport %h %p ~/.ssh/proxyauth
    ProxyCommand corkscrew 3128 %h %p ~/.ssh/proxyauth

then create a file proxyauth in .ssh folder first line with username and password as


CREATE ssh key on linux terminal

FOR creating and adding ssh key

ssh-keygen -t rsa -b 4096 -C ""
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
xclip -sel clip < ~/.ssh/

then go to

and add copied ssh key

Verify with ssh -T

and clone git using ssh url (don’t use https)


github pages domain and subdomain redirect

github ip

Force rebuild pages

git commit -m 'rebuild pages' --allow-empty
git push origin master