How to answer the git prompt in npm init for a local repo

Plastikfan picture Plastikfan · Apr 20, 2017 · Viewed 16.3k times · Source

I already have a workspace in a local private repo of the form:

../Workspace/ComponentA/

This is already checked into git. I then go to init a new component at:

../Workspace/ComponentB

so, inside ComponentB, I run npm init, and then gets to the git question, but I don't know what the correct response is to this question. What do I type to specify what is being asked by npm init, in the case where the parent folder is already in git and then new component needs to be added to git.

Thanks.

Answer

Mark Adelsberger picture Mark Adelsberger · Apr 20, 2017

UPDATE based on comment discussion:

IIRC npm init just wants to know what it should write to the attributes of the repository key in package.json. This is optional, so if you don't have a URL you want to publish in the package.json you should just be able to hit enter and move on.

In the case where you do have a URL to list, it's probably the remote fetch URL. So in that case:

git remote -v

and copy the URL.