Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBernadette Isaacson
13,736 PointsHow do you get a .gitignore file?
I am following along the course using Visual Studio. When I followed the steps to create a project I didn't get a .gitignore file. It seems like you would want one and I did notice that the course repo does have one so I know I can get it from there. However, in a typical workflow, how does one get it in the project?
Thanks for the course!
5 Answers
Bernadette Isaacson
13,736 PointsI took another look at the video where he creates the project on github. I don't know if I missed it the first time around or if the video was updated, but there is a checkbox in github to create a .gitignore file and that is the way the instructor does it.
jacobproffer
24,604 PointsHey RB,
I'm assuming that you already have a git repository set-up but you can simply create a new file and save it as .gitignore.
Here is one I created: link
Kevin Korte
28,149 PointsYeah, I follow what Jacob does, you can just create a new file and name it .gitignore
Bernadette Isaacson
13,736 PointsThanks so much for your reply, Jacob.
Yes, I do have a git repository but I noticed that without the gitignore I had 44 or something changes to push to github as opposed to the 11 the instructor had when initially creating the project, so once I added a visual studio appropriate gitignore (for example, I don't think you're supposed to download packages and such) I only had 11 which matches the instructor. Maybe there is some setting that adds a .gitignore anytime you create a project. There seem to be, oh, at least a million different configuration options that I'll have to go through some day....
Thanks again!
jacobproffer
24,604 PointsNo problem. It may be worthwhile to checkout the Git course.
Bernadette Isaacson
13,736 PointsI will certainly do that. I have created projects in visual studio and if I check the button to create a local repository then I do get a visual studio specific .gitignore as well as a .gitattributes file automatically generated--I'm more familiar with that workflow. I was just wondering if there was some way to add the auto-generated .gitignore to an already existing project other than copying it from one of my other existing projects.
Thanks! You rock!