Efficient Workflow Guide
1. SSH Keys
SSH keys provide a secure connection between your local machine and GitHub without the need to enter your username and password every time.
Generating an SSH Key:
ssh-keygen -t rsa -b 4096 -C "[email protected]"Press
Enterto accept default file locations.Enter a passphrase (optional, but recommended).
Adding the SSH Key to the ssh-agent:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsaAdding the SSH Key to GitHub:
Display the key and copy it to your clipboard:
cat ~/.ssh/id_rsa.pubGo to GitHub > Settings > SSH and GPG keys > New SSH key.
Paste your key and save.
2. Personal Access Tokens (PATs)
Tokens can be used instead of passwords when performing Git operations over HTTPS.
Generating a Personal Access Token:
Go to GitHub > Settings > Developer settings > Personal access tokens > Generate new token.
Select your desired scopes.
Save the token securely (once you navigate away, you cannot see it again).
Using PATs with Git: When prompted for a password during Git operations, use your PAT instead.
3. Cache Credentials
Avoid re-entering credentials in Git by using a credential helper to temporarily store them.
For macOS:
For Windows:
For Linux: First, install the credential helper:
Then, set Git to use the helper:
With these steps, you've optimized your GitHub setup for a smoother and more efficient workflow. Remember, security is paramount; always store tokens and keys safely.
Last updated