I have a bare repo that I setup using
git init --bare
It also has a simple post-receive hook like this that updates the web application.
git --work-tree=/foo/public_html --git-dir=/foo/root.git checkout -f
I want to also push to github but I did not want to push my entire repo.
git push github_repo
I wanted to use a .gitignore file in the root directory that ignores all my php files:
*.php
Can I do it this way?
I want to also push to github but I did not want to push my entire repo.
git push github_repo
I wanted to use a .gitignore file in the root directory that ignores all my php files:
*.php
Can I do it this way?
No.
Git's ignore system prevents files from being tracked. In other words, ignored files are never added to the repository at all. The ignore system has no effect on tracked files, so by the time the files reach your repository (bare or otherwise) they're no longer ignorable.
Currently the .gitignore in root is ignoring files on my client machine that pushes to the bare repo ( server ).
This works because it prevents the files from being tracked in the first place.
You could put all your PHP files in a separate git repository.
That way you could use it as a submodule where you need to use the PHP files. And as your bare clone has no submodules, you don't need a specific gitignore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With