gitnpm-init

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


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.


Solution

  • 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.