Vincent
Vincent

Reputation: 53

Git - How to exclude .gitignore file during checkout from bare repository?

I am working on a website locally.
I turned the folder containing its files into a repository with a working tree.

Afterwards, I push the changes to a bare "remote" repository which is also just a folder in the local disk.

I created a post-receive hook in the "remote" repository which checkouts to a certain local folder which simulates the web root in a server every time I push into the bare repository.

However, because I have a .gitignore file in the working tree, it is also checked out to what's supposed to be the "live" website.

How do I exclude the .gitignore file during checkout?
Any other tips are welcome.

Upvotes: 1

Views: 152

Answers (1)

VonC
VonC

Reputation: 1328992

Your post-receive hook is a script; it can amended to include additional step:

  • checkout the repository to local folder
  • delete the .gitignore in said local folder

That way, you always end up with the latest content, without the unwanted .gitignore file.

Upvotes: 1

Related Questions