countxerox
Posts: 17
Joined: Fri Sep 08, 2017 4:06 pm

npm git repo

Mon Sep 11, 2017 6:45 pm

Hi, I've installed npm the right way like this..

Code: Select all

mkdir prj
cd prj
npm init
npm install socket.io --save
npm install serialport --save
but I didn't specify the git repository during init, just left that blank.

Can I add that afterwards? How does it work is there a guide somewhere?

Heater
Posts: 9835
Joined: Tue Jul 17, 2012 3:02 pm

Re: npm git repo

Mon Sep 11, 2017 7:15 pm

Yes there are guides all over the net. A google search can find them. For example:

https://www.sitepoint.com/beginners-gui ... e-manager/

Yes, you can leave the git repository empty.

Should you ever put your code into a git repository, say github.com or bitbucket.org or wherever, then you can just edit the package.json file, that was created by npm init, and add it there.

countxerox
Posts: 17
Joined: Fri Sep 08, 2017 4:06 pm

Re: npm git repo

Mon Sep 11, 2017 8:12 pm

OK great, thanks Heater

countxerox
Posts: 17
Joined: Fri Sep 08, 2017 4:06 pm

Re: npm git repo

Mon Sep 11, 2017 8:17 pm

Say if I wanted to put my code in a new github repository now, how should I do that?

Heater
Posts: 9835
Joined: Tue Jul 17, 2012 3:02 pm

Re: npm git repo

Tue Sep 12, 2017 12:39 am

Go to google.com

Register yourself there.

Read the very nice github documentation and watch their videos if need be.
https://guides.github.com/activities/hello-world/

Create your new project on github.

On your Pi install git. Then change into your projects directory and do the steps shown here (starting from 3)
https://help.github.com/articles/adding ... mand-line/

countxerox
Posts: 17
Joined: Fri Sep 08, 2017 4:06 pm

Re: npm git repo

Tue Sep 12, 2017 5:56 pm

Thanks that really helped, I just made my first ever commit :D

Heater
Posts: 9835
Joined: Tue Jul 17, 2012 3:02 pm

Re: npm git repo

Tue Sep 12, 2017 6:01 pm

Great. Well done.

The wonderful thing about keeping your code in git and pushing it to a repository like github is that you no longer have to worry about screwing things up. You can experiment to your hearts content and if it goes wrong unwind it to the last known working version.

Github gives me great peace of mind even on my smallest silly projects.

Return to “Other programming languages”

Who is online

Users browsing this forum: No registered users and 4 guests