Clone project `foo’ of user `user‘ from Github

git clone --recursive https://github.com/user/foo

Add a submodule into a repository

git submodule add https://github.com/user/foo.git
git submodule init
git submodule update

Undo modification

git checkout -- [filename]

Update submodule to latest version

git fetch && git checkout master && git merge origin/master

Generate SSH key for passwordless push to Github

Source: https://help.github.com/articles/generating-ssh-keys/

ls -al ~/.ssh
ssh-keygen -t rsa -C "account@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

# Now add key to Github account (~/.ssh/id_rsa.pub)
https://github.com/settings/ssh

# Test connection
ssh -T git@github.com

# Update the repository remote URL to SSH
git remote set-url origin git@github.com:username/REPO.git
git remote -v

Advertisements