Let me preface this by saying I am extremely new to git but have a basic understanding of Source Controls.
Here's my situation. I currently use a regular shared hosting account with a basic hosting provider similar to hostgator and use ftp/cpanel. I use ftp to upload/download files from the server.
I have recently installed git on my Mac as well as Tower (Git Client for Mac) and I plan on using github to host my repository.
Let's say theoretically when I go to push files to my repo, I want to update the live files on my webserver as well to match. What's the best way of doing this?
Should I just FTP the whole repo to my host? I would imagine that开发者_如何学JAVA this could have potential problems such as changing file permissions or something else unforeseen.
I feel like I'm missing something in the process. Is there a way for me to deploy my local copy of the repo to my web server? Will I need a hosting account that offers ssh or terminal access to do this?
Should I be creating some sort of a hook.
Any info would be appreciated.
For just uploading/syncing git repo via ftp you can use git-ftp
It is pretty easy to use ... all you do to upload once you are configured is :
git-ftp push
but the fastest way to do so will always be via ssh using rsync with exclude .git.
[dev@dev_server website_repo]$ rsync -avz --exclude ".git" * dev@production_server:/var/www/mywebsite/.
Do you have ssh access to the server? If so you can just push directly to it over ssh. You can find details at the bottom of this page.
精彩评论