Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

npm-init

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.

like image 255
Plastikfan Avatar asked Apr 20 '17 14:04

Plastikfan


People also ask

How do I add a git repo to init NPM?

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.


2 Answers

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.

like image 58
Mark Adelsberger Avatar answered Oct 12 '22 23:10

Mark Adelsberger


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.

like image 20
Ben Bradfield Avatar answered Oct 13 '22 00:10

Ben Bradfield