---
{
	"title": "Working behind a proxy",
	"language": "en",
	"description": "Instructions for working behind a proxy",
	"altLangPrefix": "start",
	"dateModified": "2014-06-20"
}
---
<p>The following steps can be used for those working behind proxies that require authentication. All these methods will store your password in plain text, so use caution when doing this.</p>

<section>
	<h2>Setting the proxy for NPM installs</h2>
	<ol>
		<li>Open a command prompt</li>
		<li>Run the following commands replacing <code>USERNAME</code>, <code>PASSWORD</code>, <code>PROXY_ADDRESS</code>, and <code>PROXY_PORT</code> with your network's information:
			<ol>
				<li><code>npm config set proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
				<li><code>npm config set https-proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
			</ol>
		</li>
	</ol>
</section>

<section>
	<h2>Setting the proxy for Git</h2>
	<ol>
		<li>Open a command prompt</li>
		<li>Run the following commands replacing <code>USERNAME</code>, <code>PASSWORD</code>, <code>PROXY_ADDRESS</code>, and <code>PROXY_PORT</code> with your network's information:
			<ol>
				<li><code>git config --global --add http.proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
				<li><code>git config --global --add https.proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
			</ol>
		</li>
		<li>Run the following commands to prevent SSH problems:
			<ol>
				<li><code>git config --global url."https://".insteadOf git://</code></li>
				<li><code>git config --global url."https://github.com/".insteadOf git@github.com:</code> (<em>don't</em> remove the final colon)</li>
			</ol>
		</li>
		<li>If your computer is within a corporate network that uses personal network drives, ensure identical copies of your .gitconfig file exist on both the network drive and your local drive's user profile (e.g. <code>F:\</code> and <code>C:\Users\USERNAME</code>).</li>
	</ol>
</section>

<section>
	<h2>Setting the proxy for other tasks</h2>
	<p>Many plugins will also look for environmental variables of <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code> when they need to call out to the internet.</p>
	<ol>
		<li>You can set these variables with the value <code>http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code> each session by calling:
			<ol>
				<li>Windows Command Prompt: <code>set HTTP_PROXY=http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
				<li>Bash Shell: <code>export HTTPS_PROXY=http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT</code></li>
			</ol>
		</li>
		<li>To avoid doing this every time, you can add these commands to your console's "RC" file. If you are using the Git Bash Shell on Windows, you can add the export statements to the ".bashrc" file in the root of your user profile (<code>C:\Users\USERNAME</code>). That file is run every time you open a Git Bash session, so the environmental variables will be available from the command line. You may need to create that file with a text editor, since Windows doesn't allow creating files starting with a period in Windows Explorer.</li>
	</ol>
</section>
