tldr; use git and github on the command line
this assumes you have a github account and a mac or linux machine
how to set up git and github on the command line st. you can push and pull without entering your password every time?
make sure to have git installed
brew install git # mac
sudo apt-get install git # linux, etc.
set up your git config
git config --global user.name "John Appleseed"
git config --global user.email "[email protected]"
set up your ssh keys
ssh-keygen -t rsa -b 4096 -C "[email protected]"
copy the contents of the public key
pbcopy < ~/.ssh/id_rsa.pub # mac
xclip -sel clip < ~/.ssh/id_rsa.pub # linux
add the ssh key to your github account
- go to github.com/settings/keys
- click "New SSH key"
- paste the key into the "Key" field
- click "Add SSH key"
clone a repo using ssh
git clone [email protected]:cristicretu/cretu.dev.git
you should be able to push and pull without entering your password
For mac users you can use the mac keychain to cache your password.
optional
signing your commits with a GPG key
brew install gpg2 gnupg pinentry-mac
create the .gnupg directory
mkdir ~/.gnupg
echo "pinentry-program $(brew --prefix)/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
create `gpg.conf' file
echo 'use-agent' > ~/.gnupg/gpg.conf
add this to your ~/.bash_profile
or ~/.zshrc
export GPG_TTY=$(tty)
restart terminal, and modify permissions
chmod 700 ~/.gnupg
killall gpg-agent
create a GPG key
gpg --full-gen-key
Use (4) RSA, 4096 bits, and a passphrase
gpg --list-secret-keys --keyid-format LONG
copy the key id (the part after rsa4096/)
gpg -K --keyid-format SHORT
sec rsa4096/######## YYYY-MM-DD [SC] [expires: YYYY-MM-DD]
export
the key
gpg --armor --export ######## > public.key
configure git to use the key
git config --global gpg.program $(which gpg)
git config --glosbal user.signingkey ########
git config --global commit.gpgsign true
add the key to your github account
- go to github.com/settings/keys
- click "New GPG key"
- paste the key into the "Key" field
- click "Add GPG key"
perform a signed commit
git commit -S -m "signed commit"