Per-repo SSH keys for Git with core.sshCommand

If you keep more than one GitHub (or GitLab, or whatever) identity, you usually end up with more than one private key. The usual fixes are Host aliases in ~/.ssh/config, or typing GIT_SSH_COMMAND='ssh -i ~/.ssh/some_key -o IdentitiesOnly=yes' git … before every command. Both work. Neither is what I want when I just opened a random repo in a deep path and want my fingers to do the right thing. Reminder: you can pin the SSH command on a single clone: ...

August 2, 2023 · 1 min · 206 words

Install and Enable GIT Large File Support in OSX

If you’re navigating the challenges of large files in your Git repository—think audio clips, videos, or substantial datasets—Git Large File Storage (LFS) is your ally. In essence, it replaces bulky files with lightweight text pointers within Git, while the actual content resides on a remote server, such as GitHub. This approach not only streamlines your repository but also enhances collaboration among team members. Let’s Get Started with GIT LFS on OSX: Install Git LFS First up, let’s get Git LFS installed using Homebrew. Open your terminal and execute the following command: brew install git-lfs Initialize LFS in Your Repository Navigate to your project directory. Once you’re there, kickstart Git LFS by running: git lfs install If everything goes as planned, you’ll see the reassuring message: “Git LFS initialized.” Identify Large Files With LFS set up, it’s time to pinpoint the largest files in your repository. This step is essential for determining what needs tracking. Execute this command: find ~/Documents/path/to/repo -type f -exec du -h {} + | sort -rh | head -n 10 This command will present your top ten largest files, providing clarity on what you might want to manage using LFS. Track File Types Now that you’ve identified the heavy hitters, instruct Git LFS to track specific file types. For instance, if you’re working with video files, you might run: git lfs track '*.mp4' To view a list of all the paths, files, and types you’ve chosen to track, simply run: git lfs track ...

October 9, 2018 · 2 min · 361 words