/dotfiles

My own dotfiles.

Primary LanguageShellMIT LicenseMIT

Manjaro

  1. System setting

sudo nano /etc/pacman.conf enable this line ParallelDownloads = 10

Extensions

  • Tray Icons: Reloaded by MartinPL

  • Pano - Clipboard Manager by alperenelhan

How To Work With Multiple Github Accounts on a single Machine

1. Create SSH keys for all accounts

2. Add SSH keys to SSH Agent

3. Add SSH public key to the Github

For personal

  1. ssh-keygen -t ed25519 -C "nmhungify@gmail.com" -f ~/.ssh/personal

  2. eval $(ssh-agent -c) && ssh-add ~/.ssh/personal

  3. cat ~/.ssh/personal

  4. Paste content below vi ~/.gitconfig-personal

[core]
 sshCommand = "ssh -i ~/.ssh/personal"

[user]
 email = nmhungify@gmail.com
 name = Hung Nguyen
 signingkey = 42025A72BCA38343

[github]
 user = hungify

[commit]
 gpgsign = true

For work

  1. ssh-keygen -t ed25519 -C "work@work.com" -f ~/.ssh/work
  2. eval $(ssh-agent -c) && ssh-add ~/.ssh/work
  3. cat ~/.ssh/work
  4. Paste content below mkdir ~/work && vi .gitconfig-work
[user]
 email = example@work.com
 name = Hung Nguyen

[github]
 user = hungify2022

[core]
 sshCommand = "ssh -i ~/.ssh/work"

Create a Config File and Make Host Entries

~/.ssh/config

# For personal
Host personal
    HostName github.com
    User git
    IdentitiesOnly yes
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/personal

# For work
Host work
    HostName github.com
    User git
    IdentitiesOnly yes
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/work

.gitconfig

[includeIf "gitdir:~/"]
    path = ~/.gitconfig-personal
    exclude = ~/work/*

[includeIf "gitdir:~/work/*"]
    path = ~/work/.gitconfig-work

[push]
 autoSetupRemote = true

Finally

Note

From now on, to ensure that our commits and pushes from each repository on the system uses the correct GitHub user — we will have to configure user.email and user.name in every repository freshly cloned or existing before.

Testing

cd ~/work && ssh -T git@work or git clone git@work:hungify/xxx.git

cd ~/personal && ssh -T git@personal or git clone git@personal:hungifyXX/xxx.git

Commit Signature Verification

1. Generate GPG key

gpg --full-generate-key
gpg --list-secret-keys --keyid-format=long

2. Get the key ID

gpg --armor --export

3. Add the key to your GitHub account