0

I will walk you picture by picture through all the steps which I took before running into my problem :

  1. I created new repository EXACTLY like in the picture below. enter image description here

  2. In the picture below you can see the folder in which are included the files and folders I want to be pushed; these are : "1day" folder and "README.txt" file. I do not want to push "Resources" directory.

enter image description here

  1. I enter the folder in the picture above and open a Git Bash, then i run "git intit" for initializing git repository.

  2. I created the file .gitignore like in the picture below (I created new text file, but remove the extension and add a "." after, like this : ".gitignore.txt --> ".gitignore."

enter image description here

  1. So here I wrote in the ".gitignore" file this :

1st time : "Resources" (after running step "6)" Resources directory had been pushed, so i deleted the repository and tried again)

2nd time : "Resources\" (after running step "6)" Resources directory had been pushed, so i deleted the repository and tried again)

3rd time : "Resources.dir" (Resources directory had been pushed)

  1. I run the next 3 lines :

git remote add origin https://github.com/perjoraxul/100-Days-of-Code-The-Complete-Python-Pro-Bootcamp-for-2022.git

git branch -M main

git push -u origin main

What do i do the ignore Resources directory?

phd
  • 82,685
  • 13
  • 120
  • 165
perj
  • 15
  • 1
  • 6
  • This is because you added the resources/ file before creating the .gitignore. Remove the Resources/ file from your commit history. To do that see here: https://stackoverflow.com/a/61602985/4967403 – Alecto Irene Perez Nov 24 '21 at 18:24
  • `git push` sends *commits*, not files. Commits contain whatever files they contain: a `.gitignore` file does not change the set of files that an existing commit contains. Once made, a commit is completely unchangeable. – torek Nov 24 '21 at 18:58
  • If you have a commit you don't like (and/or can't push), you need to just stop using that commit entirely. If it's the very last commit on a branch, this is easy; if it's embedded further back, this is harder to do. – torek Nov 24 '21 at 18:59
  • Ok. Thank you very much for the answer. I will consider this as an apropriate answer for my question. – perj Nov 25 '21 at 14:03

1 Answers1

0

You should add

Resources/

in the .gitignore file