I have a project made in android-studio synced with a public Github repository.
Now I just added a file with sensitive data to my project that I never want to sync.
Is it possible to mark it from now, so it won't be pushed to Github at the next sync or any other?
I was looking through the options and did not see that possibility. I think I did that during the sync process, but I don't want to sync again just for that file and on the other hand I don't want an automatic sync to happen and the file will end up in the repository.
Is there a way to mark it for no sync?
Yes, with a file called
.gitignore
and there you add the files or folders that you want to never be synchronized. For example:.gitignore
Prevents it from syncing any file with extension
.log
.In the documentation you can find information about the .gitignore file , if it is not created you can create it in the root of your project
basically to ignore files you don't want to be versioned, if you don't want a whole directory to be added, add:
if you want files with a certain extension not to be added, add:
if you want a certain file not to be added, just add the name:
to add comments you just have to start with
#
:more information in the documentation .
You also have to git rm the file to remove it from the repository. If you want you can do git rm --cached to keep the local copy.
Important this only deletes the repository file it is still in history. If you have sensitive information you should delete it from git history