Github Tips
On this page
- Set up and use multiple GitHub accounts on the same computer
- Defaults for Github repositories
- Connect local npm to the GitHub Package Registry
- GitHub Web Editor
- Keyboard Shortcut
- octokit.js
- GitHub Pages
- Cli
- Set Secrets
- Work with fuzzy-finder tools such as fzf
- Github Readme Stats
- Awesome-Profile-README-templates
- Tips
- Workflows
- Extensions
- Tutorials
- Resources
- Set up and use multiple GitHub accounts on the same computer
- Defaults for Github repositories
- Connect local npm to the GitHub Package Registry
- GitHub Web Editor
- Keyboard Shortcut
- octokit.js
- GitHub Pages
- Cli
- Set Secrets
- Work with fuzzy-finder tools such as fzf
- Github Readme Stats
- Awesome-Profile-README-templates
- Tips
- Workflows
- Extensions
- Tutorials
- Resources
Set up and use multiple GitHub accounts on the same computer
- Create separate SSH keys for each GitHub account:
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
Save each key with a unique name (e.g., id_rsa_personal, id_rsa_work).
- Add the SSH keys to the SSH agent:
ssh-add ~/.ssh/id_rsa_personalssh-add ~/.ssh/id_rsa_work
- Add SSH Keys to GitHub
Copy the public key contents:
cat ~/.ssh/id_rsa_personal.pub
Add the public key to each respective GitHub account in the SSH and GPG keys settings.
- Create or edit the SSH config file:
nano ~/.ssh/config
# Personal accountHost github.com-personalHostName github.comUser gitIdentityFile ~/.ssh/id_rsa_personal# Work accountHost github.com-workHostName github.comUser gitIdentityFile ~/.ssh/id_rsa_work
- For each repository, set the appropriate user name and email:
git config user.name "Your Name"git config user.email "your-email@example.com"
- Clone and Use Repositories
git clone git@github.com-personal:username/repo.gitgit clone git@github.com-work:username/repo.git# For existing repositories, update the remote URL:git remote set-url origin git@github.com-personal:username/repo.git
Defaults for Github repositories

Connect local npm to the GitHub Package Registry
npm login --registry=https://npm.pkg.github.com
๐ก Enter your GitHub user info. Username is your GitHub user name. When using 2FA, password is your applicable personal access token.
๐ก Make sure your personal access token has the ability to read from GitHub Package Registry.
GitHub Web Editor
Open in github.dev editor by pressing the . (period).
Keyboard Shortcut

octokit.js
The all-batteries included GitHub SDK for Browsers, Node.js, and Deno.
GitHub Pages
GitHub Pages is designed to host your personal, organization, or project pages from a GitHub repository.
GitHub Pages is disabled by default, endable it in each repository's setting
Cli
gh
is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.
brew install ghbrew upgrade ghgh auth logingh config set git_protocol ssh
Set Secrets
gh secret set EMAIL_USERNAME -b""gh secret set EMAIL_PASSWORD -b""gh secret set SLACK_WEBHOOK_URL -b""
Note: get slack webhook url from here
Work with fuzzy-finder tools such as fzf
brew install fzfgh pr list | fzf
Note: The fzf utility allows interactively filtering the input stream and prints the selected line as its output.
Github Readme Stats
Supported by the GitHub Readme Stats
Awesome-Profile-README-templates
Tips
One second to read GitHub code with VS Code

Just add 1s after github and press Enter in the browser address bar for any repository you want to read.
Code Suggestions
# Change line

๐ Fuzzy file finder
Press t
in any repository to access it and start typing the name of the file you want to find.

Linking to code snippets
To add a code snippet: select the lines you want to reference, open the inline toolbar, click Copy permalink, and paste it anywhere.

Markdown formatting tips
[!NOTE] Highlights information that users should take into account, even when skimming.
[!TIP] Optional information to help a user be more successful.
[!IMPORTANT] Crucial information necessary for users to succeed.
[!WARNING] Critical content demanding immediate user attention due to potential risks.
[!CAUTION] Negative potential consequences of an action.
Keyboard tags
Press <kbd>W</kbd> to go up, and <kbd>A</kbd> to go down. If you can find the<kbd>ESC</kbd>, pressing that will fire missiles ๐
Visualizing hex codes
Placing hex colors in backticks renders a tile in that color.
GitHub contribution graph colors: `#C6E48B` `#7AC96F` `#249A3C` `#196127`
Visualizing diffs
10 PRINT โBASIC IS COOLโ- 20 GOTO 11+ 20 GOTO 10
Centering text and images
<div align="center"><img src="https://octodex.github.com/images/dunetocat.png" width="200" /><p>This is some centered text.</p></div><div align="center"><img src="https://octodex.github.com/images/dunetocat.png" width="200" /><p>This is some centered text.</p></div>
Inserting a video

<ahref="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE"target="_blank"><imgsrc="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"alt="IMAGE ALT TEXT HERE"width="240"height="180"border="10"/></a>
Inserting a table
Online tool to convert other formats to markdown table
Type | Battery-powered End Device | Always-on End Device | IoT Gateway | Cloud Backend Traditional |
---|---|---|---|---|
Traditional IoT | Sensor with Custom Protocol | Sensor with Custom Protocol | Transparent Proxy | Centralized Core Services |
Blockchain IoT | Server-trusting Client or Sensor with Custom Protocol | Thin Client or Server-trusting Client | Full Node or Thin Client | Miners and Full Nodes |
Inserting a table with html
<table><tr><th width="50%"><a title="show-whitespace"></a> Show whitespace characters.</th><th width="50%">Adds one-click merge conflict fixers</th></tr><tr><!-- Prevent zebra stripes --></tr><tr><td><imgsrc="https://user-images.githubusercontent.com/1402241/61187598-f9118380-a6a5-11e9-985a-990a7f798805.png"/></td><td><imgsrc="https://user-images.githubusercontent.com/1402241/54978791-45906080-4fdc-11e9-8fe1-45374f8ff636.png"/></td></tr></table>
Delete a bunch of Github Repositories
#!/bin/sh# Delete a bunch of GitHub reposnukem="repo1 repo2"user=""password_or_oauth_token=""for repo in $nukem; doecho "Deleting https://github.com/repos/$user/$repo"curl -v -u "$user:$password_or_oauth_token" -X DELETE \"https://api.github.com/repos/$user/$repo"done
Count total files
git ls-files $notes | wc -l
Count diff files
git diff --name-only "@{1 day ago}" $notes | wc -l
Workflows

Extensions
Browser extension that simplifies the GitHub interface and adds useful features
Browser extension that enhances GitHub code review and exploration.
Tutorials
Resources
HelloGitHub is sharing interesting, entry-level open source projects on GitHub.
The official GitHub REST API v3.