How to Manage Dotfiles on GitHub

Keeping your dotfiles under version control is a great way to maintain consistency across multiple machines and track changes to your configuration over time. Here’s a step-by-step guide to managing your dotfiles on GitHub. 🏗️ Basic Setup 1. 🆕 Create a New GitHub Repository Log in to GitHub and create a new repository (e.g., dotfiles) Choose between public or private (private is recommended if your configs contain sensitive information) 2. 🗂️ Organize Your Local Dotfiles # Create a dotfiles directory mkdir ~/dotfiles # Copy or move your configuration files cp ~/.zshrc ~/dotfiles/ cp ~/.vimrc ~/dotfiles/ cp ~/.gitconfig ~/dotfiles/ # Add other configuration files as needed 3. ⚙️ Initialize the Repository cd ~/dotfiles git init git add . git commit -m "Initial commit" 4. 🔗 Connect to GitHub Repository git remote add origin [email protected]:<your-username>/dotfiles.git git branch -M master git push -u origin master 🚀 Advanced Configuration 🔗 Manage with Symbolic Links Instead of placing files directly in your home directory, use symbolic links: ...

April 1, 2025 · 2 min · 320 words · 0xuki

github 備忘・対処メモ

.gitignoreが効かない キャッシュ削除による解決を試みます。 git rm -r --cached . git push がreject ローカルが正/originであることを確認して、強制的にpushします。 git push -f origin master git pull error マージエラーが発生 error: Your local changes to the following files would be overwritten by merge: test.py Please commit your changes or stash them before you merge. Aborting Solve it by overwriting 上書きして解決する場合 pull元が正しい前提で上書きを行います。 git fetch origin master git reset --hard origin/master git pull origin/master sshで2つのgithubアカウントを管理 ~/.ssh/configに2つのアカウントを記載 2つ目をサブに設定 Host github github.com HostName github.com IdentityFile ~/.ssh/rsa-git User git Host github github.com.sub HostName github.com IdentityFile ~/.ssh/rsa-git-sub User git remote URLを以下に設定 ...

June 6, 2021 · 1 min · 168 words · 0xuki