Category Archives: git

Proxied…

If you work in a corporate behind a firewall, most likely you would need to configure proxy for any of the dev tools that talk to the internet. The write-up below talks about configuring proxy for:

  • Maven – Build and management tool for any Java-based project
  • Git – Distributed version control system
  • npm – Node Packaged Modules (Package manager for Node.js)
  • Bower – Front-end package manager

In order to work with any of the above tools, you would need to have access to the internet. And if your company/client uses a proxy server, you would need to configure these tools to use that proxy in order to talk to the internet.

  • Maven

Add the following section in your maven settings.xml (typically located at ${user.home}/.m2/settings.xml).

<settings>
  .
  .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  .
  .
</settings>

For a detailed description on the different settings, please refer to this link.

  • Git

For using git over HTTP, execute the following command.

git config --global http.proxy http://<proxy_server>:<proxy_server_port>
  • npm

Execute the following command. You might want to put it as part of your .bash_profile (for bash) or the profile file of your favorite shell so that you do not need to set it up whenever you open up a new command shell.

npm config set proxy http://<proxy_server>:<proxy_server_port>
  • Bower

Set the following environment variable:  HTTP_PROXY or HTTPS_PROXY (as per your needs).

export HTTPS_PROXY=http://<proxy_server>

Again, you might would want to put it as part of your .bash_profile (for bash). In case of windows, add a new User environment variable.

Advertisements

Git: Deleting branches and tags

Deleting local branch

git branch -d branchName

Deleting remote branch

git push origin :branchName

Deleting local tag

git tag -d tagName

Deleting remote tag

git push origin :refs/tags/tagName

Pushing tags into a Git repository

To push a tag into a Git repository, you need to execute the following command:

git push --tags

The usual git push –all does not push the tags.

This is quite a handy tip, especially when you just have a tag to be pushed to the repository and do not have any other local modifications.