Starting In A New Company? Think Npmrc And Git Name

How to configure your company’s npm Enterprise registry and provide your name for Git interactions

Image for post
Image for post
Photo by Max Rovensky on Unsplash

Setting your company’s npm Enterprise registry

If the company has hired you, there is a good chance that, unfortunately, at least some of their work is only available as closed source and distributed with a npm private registry. To configure such an entry, you can run the following command line in a terminal.

npm config set registry https://registry.company.com:1234

Npmrc

If like me you are using your own laptop, you might not want to modify or mix up your private configuration with you client configuration right?

npm i npmrc -g
npmrc -c client
npm config set registry https://registry.company.com:1234

Switch Between Profiles

Cool we now in our “client” profile, but how do we go back to the previous one, the default one? Nothing easier, run the npmrc command followed by the profile’s name.

npmrc default
npmrc client
 npmrcAvailable npmrcs:* defaultclient

Manual Configuration

You might like command lines but you may also rather like to modify manually your configuration using vi for example 😉.

 ls /Users/daviddalbusco/.npmrcs/default
/Users/daviddalbusco/.npmrcs/default
ls /Users/daviddalbusco/.npmrcs/client
/Users/daviddalbusco/.npmrcs/client
ls -ltr /Users/daviddalbusco/.npmrc
/Users/daviddalbusco/.npmrc -> /Users/daviddalbusco/.npmrcs/default

Setting Your Name In Git

To specify another name and email for your Git activity, you can either edit your global config or proceed by repository, up to you. I personally rather like to proceed by projects because I’ve got many clients.

[user]
email = david.dalbusco@company.com
name = David Dal Busco
git config --global user.name "David Dal Busco"
git config --global user.email "david.dalbusco@company.com"
git commit --amend --author=”David Dal Busco <david.dalbusco@company.com>”

Summary

Well I am pretty sure that even if I wrote the above lines, I may forget again in the future how I have to proceed. But at least this time, I will just have to browse my blog history 😇.

Freelancer by day | Creator of DeckDeckGo by night | Organizer of the Ionic and IndieHackers Zürich Meetup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store