Mercurial: edit ~/.hgrcas shown here: http://www.selenic.com/mercurial/hgrc.5.html#http-proxy
Git: edit ~/.gitconfigadd an entry like this: [http] proxy = hostname:port