Notes to Self

Alex Sokolsky's Notes on Computers and Programming



And more:

Global Config

Followed Customizing Git Configuration.

git config --global "Alex Sokolsky"
git config --global ""
git config --global core.editor /usr/bin/emacs
git config --global core.excludesfile ~/.gitignore_global
git config --global core.pager ''

where ~/.gitignore_global:


Handling an Upstream Repo

alex@latitude7490:~/Projects/psmqtt/ > git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)

alex@latitude7490:~/Projects/psmqtt/ > git status
On branch typing
Your branch is up to date with 'origin/typing'.

nothing to commit, working tree clean

Just pull from upstream:

alex@latitude7490:~/Projects/psmqtt/ > git pull upstream master

And then push

alex@latitude7490:~/Projects/psmqtt/ > git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
   a98ddea..52094f3  master -> master

Repo-specific Config

Set repo-specific (non-global) config settings:

git config "Alex Sokolsky"
git config ""
git config core.sshCommand "ssh -i ~/.ssh/private_key"

Make sure your private identity is available:

ssh-add ~/.ssh/private_key


git remote add origin
git push --set-upstream origin master

Importing a file from a different repo

Instead of using git submodules, sometimes this may make more sense:

# This will update DST with the latest version of SRC from REPO.
# Exit on error. Append "|| true" if you expect an error.
set -o errexit
# Exit on error inside any functions or subshells.
set -o errtrace
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
set -o nounset
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
set -o pipefail
# Turn on traces, useful while debugging but commented out by default
#set -o xtrace
# Check syntax with `shellcheck ./goto`

# this repo root
DSTROOT=$(git rev-parse --show-toplevel)
# this one already defined in MacOS
: "${TMPDIR:=/tmp}"

pushd "${TMPDIR}" > /dev/null
echo "Retrieving ${REPO}/${SRC}"
git clone --quiet --no-checkout --depth 1 "${REPO_HOST}/${REPO}.git"
cd $REPO
echo "Overwriting ${DSTROOT}/${DST}"
git show HEAD:$SRC > "${DSTROOT}/${DST}"
popd > /dev/null
rm -rf "${TMPDIR}/${REPO}"

Hosting a Repo in a Cloud


Product github gitlab bitbucket
Company Microsoft GitLab Atlassian
Public repo pricing  
<=5 users $0 $0 $0
>5 users $0 $0 $2/user/month
Private repo pricing  
<=5 users $25/month $0 $0
>5 users $9/user/month $0 $2/user/month