0

I am new to Git and Github. I have been trying to create a repository in order to commit and push a project of mine onto my github page. I am using github desktop to do it and I am getting a couple of issues that are driving me absolutely crazy.

This is what I am doing right now:

First I create a new repository on Github. Its name is the same as the name of my project on my computer.Then I create a .gitignore file in the repository. Then I open Github Desktop and try to clone the repository to my machine. After that, I move my project folder to the path where the cloned repository is. This is when the issues begin:

  1. First and foremost, when I push my files, the .gitignore file doesn't work. My whole project gets pushed onto Github.

  2. I am also getting the following message pop-up "The output from the command could not fit into the allocated stdout buffer. Set options.maxBuffer to a larger value than 10485760 bytes". This keeps popping up every 5 seconds or so. It is driving me insane. I tried to look for maxBuffer in options but it is not in the menu.

I mostly care about issue #1. Am I making a mistake when I create my .gitignore file in my repository on Github? Should I instead just place a new .gitignore file in my local project folder and then push my files from there (I did this too and the .gitignore file was again ifnored)?

Edit: For the ones wondering, I have already tried creating a .gitignore file inside the GitHub project itself, and it didn't work!

Swifty
  • 839
  • 2
  • 15
  • 40
  • 1
    .gitignore will help `git add` avoid adding files you don't want in your repository, if you've already added those files then that ship has sailed, .gitignore won't stop you from committing changes to those files or "pushing them to a remote". – Lasse V. Karlsen Nov 07 '17 at 07:36
  • I am not sure I understand what you mean. The repository I have just created is empty (as in it only has a .gitignore file in it). Assuming that by adding you mean committed and pushed then I haven't added any of those files yet. How would you go through this process if you had a local project that you wanted to add to your github? – Swifty Nov 07 '17 at 08:09
  • Your statements conflict with each other. You're saying that when you push, your whole project gets pushed onto Github, then clearly the repository cannot be empty. – Lasse V. Karlsen Nov 07 '17 at 08:25
  • Yes, but before I push my project, the .gitignore file is in the repository (and in the project folder on my local machine). Why is the .gitignore not working? The files that I am asking .gitignore to ignore are instead being pushed onto my Github. Do you know why this is is happening? – Swifty Nov 07 '17 at 08:31
  • Ok picture this: You create a Github repository. Then, you create a .gitgnore file inside your project folder on your local machine. Inside this .gitignore, you write a bunch of files that are present in your project folder. THEN, you push the entire project folder to your repository, and then you realize that the files that you asked .gitignore to exclude from your commit have actually been uploaded to your repository. Why is that? – Swifty Nov 07 '17 at 08:33
  • 1
    Between creating an _empty_ repository and pushing a _non-empty_ repository there must be a phase of changing one into the other, ie. adding and committing files. Your description of what happens does not cover this phase. – Michał Politowski Nov 07 '17 at 10:39

1 Answers1

0

Maybe you pushed your files once and then realized you don't want to upload them? So you created the .gitignore? If so, the problem happens because the files you want to remove are still saved in the index.

Please check this post, maybe you need to run

git rm --cached <file_name.extention>

for each of your files you don't want to be uploaded.

Tms91
  • 3,456
  • 6
  • 40
  • 74