I want to update my sources.list file with the fastest server from the command line in a fresh Ubuntu Server install. I know this is trivially easy with the GUI, but there doesn’t seem to be a simple way to do it from from the command line?

Automated Process

If you want a utility to do this you could implement such a utility as a simple bash script like the following.

 Read More

Configure Git to use a proxy

##In Brief

You may need to configure a proxy server if you’re having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

Or for a specific domain, something like:

Setting http.<url>.sslVerify to false may help you quickly get going if your workplace employs man-in-the-middle HTTPS proxying. Longer term, you could get the root CA that they are applying to the certificate chain and specify it with either http.sslCAInfo or http.sslCAPath.

See also the git-config documentation, especially the following sections if you’re having HTTPS/SSL issues

  • http.sslVerify
  • http.sslCAInfo
  • http.sslCAPath
  • http.sslCert
  • http.sslKey
  • http.sslCertPasswordProtected

In Detail

Configure the proxy

You can configure these globally in your user ~/.gitconfig file using the --global switch, or local to a repository in its .git/config file.

Setting a global proxy

Configure a global proxy if all access to all repos require this proxy

URL specific proxy

If you wish to specify that a proxy should be used for just some URLs that specify the URL as a git config subsection using http.<url>.key notation:

Which will result in the following in the ~/.gitconfig file:

Handle subsequent SSL protocol errors

If you’re still having trouble cloning or fetching and are now getting an unable to access 'https://...': Unknown SSL protocol error in connection to ...:443 then you may decide to switch off SSL verification for the single operation by using the -c http.sslVerify=false option

Once cloned, you may decide set this for just this cloned repository’s .git/config by doing. Notice the absence of the --global

If you choose to make it global then limit it to a URL using the http.<url>.sslVerify notation:

Which will result in the following in the ~/.gitconfig file:

Show current configuration

To show the current configuration of all http sections

If you are in a locally cloned repository folder then you drop the --global and see all current config:

Unset a proxy or SSL verification

Use the --unset flag to remove configuration being specific about the property — for example whether it was http.proxyor http.<url>.proxy. Consider using any of the following: