repository snippets

Extract Git directory to new repository

Tagged git, repository  Languages bash

This will extract lib/module_b sub directory to a new Git repository while preserving Git history for that sub directory:

git clone module-b
cd module-b
git remote rm origin
git filter-branch --subdirectory-filter lib/module_b -- --all


How to use private Github repositories with Bundler

Tagged bundler, git, github, private, repository  Languages bash

Does your Gemfile reference private Github repositories?

Option 1: ENV variable

export BUNDLE_GITHUB__COM=username:password
export BUNDLE_GITHUB__COM=<personal-oauth-token>:x-oauth-basic

Option 2: bundle config

bundle config username:password

Option 3: ~/.git-credentials

echo 'https://user:[email protected]' >> ~/.git-credentials