I am reading a book by Ethan Brown called Learning JavaScript. On Ch2 the author will start describing and teaching how to use some tools that will be interesting to learn throughout the course. One of them is git.
There is this part where he tells me to add .gitignore and add a few contents to it.
But I haven't found a way that didn't throw me errors. The passage goes as follows:
First, from your project root, initialize a repository:
$ git init
This will create a project repository for you (there’s now a hidden directory called .git in your project root).
Inevitably, there will be some files you never want tracked in version control: build artifacts, temporary files, and the like. These files can be explicitly excluded in a file called .gitignore. Go ahead and create a .gitignore file now with the following contents:
# npm debugging logs npm-debug.log* # project dependencies node_modules # OSX folder attributes .DS_Store # temporary files *.tmp *~
I was able to create the git init. That was easy. But from then on things got a little complicated.
I tried adding the .gitignore file from this resource provided by sully6768 -> How to create .gitignore file
And it worked. But I wasn't able to commit the content to .gitignore.
So pretty much my question is...
How do I make the part bellow work using Linux Terminal.
Go ahead and create a .gitignore file now with the following contents:
# npm debugging logs npm-debug.log* # project dependencies node_modules # OSX folder attributes .DS_Store # temporary files *.tmp *~
I don't know how to do that.
Thank you in advance.
Other sources investigated:
Citation from: Learning JavaScript by Ethan Brown Copyright © 2015 O’Reilly Media. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
I saw that I could answer my question provided I have come to a conclusion on what is the best approach provided the question I made it. And in order not to leave another question unanswered. So here I go:
The answer Mr. Minh provided isn't actually wrong but it doesn't deliver what the OP (me) want which is to create a .gitignore file and add those features in the file using the terminal. In order to do this in Debian9 you should:
cat >
to create the .gitignore file.So this is how it is going to work.
Once you have navigated into your desired folder you will use cat > .gitignore
which will allow you to write whatever you want in it. Like this...
And when you finish you just need to press ctrl c (on Debian9) and the file will be created and saved with the info desired.
For more information on how to use the cat >
to create file please follow the link below.
How to quickly Create a Text File using the command Line in Linux by Walter Glen