I was recently wondering about if deploying code directly cloned from git is ok for passing my project to production, and if it isn't if there's a way to do it better.
I wouldnt do that. Theres a lot of metadata in your .git folder that contains history about your project and many unnecessary versions of files you dont need to deploy. It may even contain passwords from previous commits you thought you removed. Furthermore the sheer number of files in the .git directory makes file copy slow.
I am guessing theres an easier way to do it , but ive used both git archive
and also a custom deploy script to ship only the files i need.