Github

Anh-Thi Dinh

Markdown Flavor

Toggle block

1<details>
2<summary>Click to toggle contents of `code`</summary>
3
4```
5CODE!
6```
7</details>

Alert styling

1> [!NOTE]  
2> Highlights information that users should take into account, even when skimming.
3
4> [!TIP]
5> Optional information to help a user be more successful.
6
7> [!IMPORTANT]  
8> Crucial information necessary for users to succeed.
9
10> [!WARNING]  
11> Critical content demanding immediate user attention due to potential risks.
12
13> [!CAUTION]
14> Negative potential consequences of an action.

View README.md localhost

1pip install grip # <https://github.com/joeyespo/grip>
2cd myrepo
3grip # Running on <http://localhost:6419/>
Update: grip support with limited times of usage, we can use VSCode markdown previwer instead, it’s builtin.

Clone with Personal Access Tokens (PAT)

Go to this link to generate a new PAT. Then using your PAT as a password.
1$ git clone <https://github.com/fakeuser/fake-repo.git>
2Username: <your_username>
3Password: <your_personal_access_token>

Clone via git@ (ssh)

☝️
Update: It's easier if we use Github CLI!
Below codes are for: using 2 different accounts via ssh with 1 default.
1# Global (default to acc 1)
2git config --global user.name "Your Name 1"
3git config --global user.email "[email protected]"
4
5# Per repo
6cd /path/to/special-repo
7git config user.name "Your Name 2"
8git config user.email "[email protected]"
9
10# Generate ssh key for each account
11ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_account1
12ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_account2
13
14# in ~/.ssh/config
15Host github.com-account1
16    HostName github.com
17    User git
18    IdentityFile ~/.ssh/id_ed25519_account1
19
20Host github.com-account2
21    HostName github.com
22    User git
23    IdentityFile ~/.ssh/id_ed25519_account2
24    
25# add public key to github
26cat ~/.ssh/id_ed25519_account1.pub
27# Then go to Settings → SSH and GPG keys (choose Key type "Authentication Key")
28cat ~/.ssh/id_ed25519_account1.pub
29# The same
30
31# Test
32ssh -T github.com-account1
33
34# Test git operations
35git pull
36
37# If: Repository not found
38git remote -v
39# If something like
40origin	https://github.com/SomeThing/something-hehe.git (fetch)
41origin	https://github.com/SomeThing/something-hehe.git (push)
42# Do
43git remote set-url origin [email protected]:SomeThing/something-hehe.git
44# (If you clone this repo by Gitkraken, doing this still doesn't affect Gitkraken)
45
46# Try again
47git pull

Info

  • Commits to a fork don't appear in your contributions graph.
  • Commits to a generated from template can appear in your contributions graph.
  • Get size of a github repo: https://api.github.com/repos/<user>/<repo> then find property "size". The size is in KB.

Repo template

Add Shields tags

👉 Main shield site here.
👉 Example of usage:
my main github page.
1# scikit-learn badge
2<http://img.shields.io/badge/-Scikit%20Learn-efa300?style=flat-square&logo=scikit-learn&logoColor=fff>
3# ...<NAME>-<Background-Color>?style...&logo=<LOGO>&logoColor=<LOGO-COLOR>
  • Logo name can be found at simpleicon. If the name includes spaces, replace them with dashes (e.g: ?logo=visual-studio-code)
  • Wanna create a custom logo?
    • Change SVG to PNG if needed: use this site.
    • (Optional) Change logo's color to white: use this site.
    • Must resize the image to 14x14: use this site.
    • Convert to base64 file: use this site, then copy data:image/png;base64,iVB... and paste after &logo=

Troubleshooting