How is the Git hash calculated?

As described in “How is git commit sha1 formed “, the formula is: (printf “<type> %s\0” $(git cat-file <type> <ref> | wc -c); git cat-file <type> <ref>)|sha1sum In the case of the commit 9eabf5b536662000f79978c4d1b6e4eff5c8d785 (which is v2.4.2^{}, and which referenced a tree) : (printf “commit %s\0” $(git cat-file commit 9eabf5b536662000f79978c4d1b6e4eff5c8d785 | wc -c); git cat-file … Read more

You are on a branch yet to be born

As ever, Git is right, it just has a quirky way of saying it: when you create a repository, the master branch actually doesn’t exist yet because there’s nothing for it to point to. Have you tried committing something after your git init? Adding a remote and pulling from it will also work, of course.

git: How do I recursively add all files in a directory subtree that match a glob pattern?

It’s a bug in the documentation. Quote the asterisk with $ git add documentation/\*.screen or $ git add ‘documentation/*.screen’ to get the behavior you want. If instead you want to add files in the current directory only, use $ git add *.screen UPDATE: I submitted a patch that corrects the issue, now fixed as of … Read more

Ansible SSH private key in source control?

It’s a bad idea to store any kind of plaintext secret in revision control, SSH private keys included. Instead, use ansible-vault to store the private key. ansible-vault can operate on any file type. Just encrypt the file with ansible-vault encrypt /path/to/local/private_key then install the key: – name: Install a private SSH key vars: source_key: /path/to/local/private_key … Read more