Update website with a single command (git push) instead of FTP drag and dropping

Posted by Wolfr on Stack Overflow See other posts from Stack Overflow or by Wolfr
Published on 2009-05-19T16:49:44Z Indexed on 2010/03/29 4:13 UTC
Read the original article Hit count: 300

Filed under:
|
|
|

Situation:

  • I have a local copy of a website
  • I have a server that I have SSH access to

What do I want to do?

  • Commit locally until I'm happy with my code
  • Make branches locally
  • Have one master branch that is the one that should be pushed to the server
  • Update the website using a single command (git push origin master)

If I set up a git repo locally using git init, and then push to a folder on the server, it doesn't work. When I FTP to the server to check the files, they're actually there. When I SSH into the server and do git status, it's not clean, even though it should be since I just pushed to the server.


Steps I'm doing:

  1. Make a new folder on my computer (mkdir folder_x)
  2. Go into that folder (cd folder_x)
  3. Set up a new git repository there (git init)
  4. (git repository sets up successfully)
  5. Push the repository to the server using git push origin master (where origin is set up as user:[email protected])

© Stack Overflow or respective owner

Related posts about version-control

Related posts about git