15

I know what git is for and how to use it, (a little bit) but there is one concept I still don’t fully understand. I have heard a lot of web developers lately saying that they use git for every web project even though they are not collaborating, they just use git as an FTP alternative, in fact they claim that FTP is an old method to upload your sites.

My question is, how could I use git to upload my site without having to pay for a service such as beanstalk?

Is really FTP considered an old technology and we should be using git?

Thanks a lot

fs_tigre
  • 10,650
  • 13
  • 73
  • 146
  • 7
    You cannot compare Git wit FTP. Apples and oranges. Since Git has capabilities to synchronize repositories across different machines (i.e. it can transfer files), you *could* use it as FTP alternative. However, the main purpose of using Git is of course having a SCM. So: No, you should not use Git instead of FTP, but for your project, you should use Git (or any other SCM). – Felix Kling Feb 15 '13 at 02:28
  • 1
    +1 on everything Felix said. Also, if you're using a [VCS](http://en.wikipedia.org/wiki/Revision_control) (perhaps a better term than SCM in this case), explore [`git archive`](http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export) which will help you package a release for publishing to your web server. – ghoti Feb 15 '13 at 02:41
  • "My question is, how could I use git to upload my site without having to pay for a service such as beanstalk?" How does this solicit debate, etc? – brentonstrine Feb 28 '15 at 07:56

2 Answers2

9

See the following links for instructions on how to deploy a Git repo to your server:

Jeff Miller
  • 2,405
  • 1
  • 26
  • 41
9

Using your favourite version control is the only sensible way to deploy anything.

Git is not only about collaboration and distributed VCS it is also a serverless VCS (by definition) - so you can deploy from your dev machine to your deployment target.

To summarise when setup properly to deploy your changes is as simple as;

git push hub master

For more information A web-focused Git workflow and Using Git for Deployment

I'm not going to answer the subjective bit of the question; there are a myriad of reasons why I'd deprecate FTP - but it is a valid way of transferring files as long as you understand the limitations of the technology.

I will however say that you absolutely must be using version control within your deployment strategy.

Richard Harrison
  • 19,247
  • 4
  • 40
  • 67
  • *"Using your favourite version control is the only sensible way to deploy anything."* ... How does that apply for compiled websites like ASP.NET or JSP? Or do you just mean using version control to commit to master/default and push so your build server picks it up, builds it and deploys it? – mo. Oct 31 '13 at 16:24
  • ASP.NET I've done various ways; the simplest is to include the deployment package or binaries into the repo and push this out; also built a custom one; but this is what I'd do today http://www.jayway.com/2012/10/17/a-simple-continuous-integration-and-deployment-workflow-with-asp-net-mvc-github-and-jenkins/ It's the concept of doing it from FVC rather than the method (of which there are many) that I was trying to get across. – Richard Harrison Oct 31 '13 at 18:10