Git and coding: tip and tricks
- Socks Proxy: To access our GitLab website from IPs outside the Internet Archive’s network you need a socks proxy. To do so you can:
- You can open a sock proxy with:
ssh -N -D <port> username@archive.org
and configure manually your browser or your network to use the socks proxy.
- if you are using OSX you can use this script to make the socks proxy setup easier.
- You can open a sock proxy with:
- Sublime Text: if you are using sublime text to develop your code, you will appreciate this how-to use sublime text over ssh.
- Memory problem: if running
git push
you have this error:fatal: Out of memory, calloc failed
, you can configure git to use only one thread for “packing”:git config --global pack.threads 1
another “solution” is to remove the limit:
ulimit -v unlimited
- Git prompt:
- If you’re a Bash user, you can tap into some of your shell’s features to make your experience with Git a lot friendlier. Git actually ships with plugins for several shells, but it’s not turned on by default. Take a look to: Git prompt [2].
- If you’re using zsh, and also make use of oh-my-zsh, many themes include git in the prompt. It is recommended that you set git config –local oh-my-zsh.hide-dirty 1 within the petabox repo to prevent a slow prompt.
- How to rename the author info for all the commits in a repo:
- for a single commit:
git commit --amend --author "New Author Name <email@address.com>"
- for all the commits in a repo:
git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Josh Lee" ]; then export GIT_AUTHOR_NAME="Hobo Bob"; export GIT_AUTHOR_EMAIL=hobo@example.com; fi; git commit-tree "$@"'
- for a single commit:
kelsey 2:58 am on August 18, 2015 Permalink
Here is some info I found the hard way on Mac & case-sensitive git repos http://kelsey.blog.archive.org/2015/08/18/mac-case-sensitive-git-repos/
pooh 5:34 am on August 18, 2015 Permalink
i have a script in ~tracey/scripts/post-commit that one can copy to petabox/.git/hooks/ to make the “update the $Id….$ thing in the file” (mostly useful for deriver hackers now, etc.)
traceypooh [3:25 PM]
(it re-checks out file after commit, so your version now has the $Id….$ string updated in the file you just committed)
pooh 5:34 am on August 18, 2015 Permalink
[petabox tree file last mod times]
~tracey/scripts/post-checkout is nice to add in petabox/.git/hooks/ when one first clones a tree (technically, clone the tree, then add this hook, then checkout a file — it will take a *long* time to run, then remove the hook). this will make all files have modtime of their last commit (which can be v. helpful to determine quick age/modtimes of files at a “ls” glance) for those who like that kind of thing
kelsey 10:31 pm on September 25, 2015 Permalink
That pesky error that we ran into before
Most likely means that the user is trying to clone a repo that they don’t have access to. Add the user to the project members, and you’re good to go