Given:

  1. A password file that does not need to be uploaded to GitHub.
  2. In .gitignore this file is registered and marked in gray in the studio.

enter image description here

Problem:

When you commit this file, it is marked and highlighted in the list of files for a commit:

enter image description here

Question:

What happens when commit-> push? The file will be saved on GitHub and will be available to everyone or just in the history of commits will be listed as added to the project, but will it physically exist only on my machine due to the addition to gitignore?

PS
because in the file passwords and appearance try to fear myself (

1 answer 1

It was possible to solve the problem by removing the file from the project, making a commit without it and adding it again.
After these manipulations, the file ceased to appear in the list of files for commit.

Apparently, you must first compile .gitignore and only then add ignored files to the project.


According to the link @Yura Ivanov, for those who know how to command it is enough to run this command to ignore files added before changing .gitignore :

 git rm --cached <file> 
  • But after all, in the reference to en SO, we suggested the option to do the same through the git rm --cached <file> command so that the files that were added ( add ) were not tracked before the gitignore compiled. - StateItPrimitive
  • @StateItPrimitive, unfortunately I am not friends with the command system. I honestly tried using the standard git command in the folder with my project and go into it through gitshell . In the first case, the command did not recognize this command line, in the second I could not apply the examples from Google. To use the command line you need to be able to use it ( - YuriySPb
  • @StateItPrimitive, and, by the way, thank you - you pushed me to the decision with your remote comment) - Yuriy SPb
  • Apparently, you quickly read it :) - StateItPrimitive
  • @StateItPrimitive, I was furiously complaining about F5 right after the publication) This problem irritated me very much - I had to go to bed yesterday without having decided it ( - YuriySPb