Answer the question
In order to leave comments, you need to log in
Is it possible to somehow have a file in the local repository, but at the same time so that it does not get pushed to the remote one?
I want to have .env in the local repository - for example, to use different bases in different branches.
But at the same time, I don't want .env to be pushed to github.
Is this possible in Git?
Answer the question
In order to leave comments, you need to log in
Git pushes not files, but branches with commits, so the external repository will contain an exact copy of the local data. The repository is essentially one, and it is distributed. This is how Git works. There is no difference local or external.
Do not store configs in the repository at all if it goes public!
So the correct answer to the question is no.
But you can unpack (checkout) different branches into different directories (worktree). And for everyone you can make the necessary settings. So you get what you want and passwords do not have to shine in a public external repository.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question