25

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.

2 Answers 2

28

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.

3
  • 1
    But I don't have a remote defined yet and git remote -v returns nothing. I am in the initial stages of this project, and haven't defined a remote yet, but there are parent directories of ComponentB that are in git. Actually I've just looked at the package.json of ComponentA, which is also already commited and it does even have a git entry. So can I just ignore the git question for now and simply hit return without entering anything?
    – Plastikfan
    Commented Apr 20, 2017 at 14:50
  • 1
    I would think so. Commented Apr 20, 2017 at 14:52
  • 1
    Ok great thanks Mark. If you just re-answer the question summarising this, I can mark the question answered, cheers.
    – Plastikfan
    Commented Apr 20, 2017 at 14:54
4

If you have a github repository you want to use, get the HTTPS address by clicking the green Code button. Put the address in during npm init startup or update in the package.json.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.