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.
  • 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 "$@"'