Hey i'm new to git but I understand the basics but I'm confused about pushing to server from a client machine using SSH. (we're using a private server)
Here's what's going on: I clone the repo off the server. I change a file, add and commit it then do git push origin master.
However I get some error that doesn't allow me to push because the repo is already 'checked out' on the server. I read about the issue here: Git push error '[remote rejected] master -> master (branch is currently checked out)' But I don't really understand the answer. Some people recommended to change the config receive.denyCurrentBranch setting but that simply made the error MESSAGE go away; it didn't actually let the push go through.
Another suggestion that actually worked is switching the branch that the server is on.
So if a user is working on the master branch; on the server I can switch to a temp branch and the user can push changes without issue to the master branch. However the issue with this is if the server is on its temp branch, and a new user needs to clone the repo, they'll end up cloning the temp branch and then again won't be able to push changes (because they'll be pushing to the 'checked out' temp branch).
Sorry for the rant I guess my questions comes down to this: what is the proper way to push changes to server or how do development teams deal with pushing to server? Thanks for any help.