Git
Table of Contents
Set up SSH on Github
- Generate new SSH key
ssh-keygen -t ed25519 -C "your_email@example.com" - (Optional) Set personalized filename for
SSH_key> Enter a file in which to save the key (/Users/you/.ssh/id_ed25519): [Press enter] - Start the
ssh-agentin the backgroundeval "$(ssh-agent -s)" - Add
SSH keyto the ssh-agentssh-add {path/to/SSH_key) - Copy content of
SSH_key.pubto your Github account - Test your SSH connection with Github
ssh -T git@github.com
Activate Git SSH
#!/usr/bin/bash
# SSH credentials
SSH_KEY=$HOME/.ssh/github
# Activation script
eval "$(ssh-agent -s)"
ssh-add $SSH_KEY
echo "GitHub credentials activated!"
Using .gitignore
- Single file
- Put the exact filename.
.DS_Store
- Put the exact filename.
- Directories
- Include their paths and putting a
/on the end. - If
/is not present, it will match both files and directories with that name.node_modules/ logs/
- Include their paths and putting a
- Negation
- Use a prefix of
!to negate a file.!example.log
- Use a prefix of
- Double Asterisk
**can be used to match any number of directories.**/logsmatches all files or directories named logs**/logs/*.logmatches all files ending with.login a logs directorylogs/**/*.logmatches all files ending with.login the logs directory and any of its subdirectories.logs/**matches all files inside of logs.
- Comments
- Any lines that start with
#are comments.# macOS Files .DS_Store
- Any lines that start with