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 https://github.com/xxx/module-a.git module-b
cd module-b
git remote rm origin
git filter-branch --subdirectory-filter lib/module_b -- --all

Via

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 https://github.com/bundler/bundler.git username:password

Option 3: ~/.git-credentials

echo 'https://user:pass@example.com' >> ~/.git-credentials

References https://github.com/rubygems/bundler/pull/3898 https://git-scm.com/docs/git-credential-store