1

I have developed a web-app in PHP, and I have been using GIT in my local machine to source-control it.

Now I have a simple hosting at MediaTemple, and I'd like to publish my site, just using GIT. So, how do I do that?

I thought about making git init at the server and cloning my local repo, after that, I could set my local repo remote origin to be the server one, so all I have to do to publish is a git push origin master on my local machine. But I am concerned about how many .git/ folders and docs is my server going to have, and if that's dangerous for the server.

I only want to have the needed files there, read: source files, not source control files.

Any suggestion? Or should I do it just this way and forget about hidden files?

Thanks in advance!!

2
  • There'll only one .git folder at root of the repo on your server. I don't know about doc folder, do you mean your project doc or git doc? Commented Oct 10, 2012 at 12:09
  • can't you just pull the latest version (locally) and upload it? If you want to use git at server site you need git installed & access to the server's cli (via telnet, ssh, or directly on the machine) and pull the latest version. Commented Oct 10, 2012 at 12:19

1 Answer 1

1

When you do git push, your remote working directory is not updated (i.e. git checkout will not automatically happen on the remote side). You can use git pull from the remote side like:

ssh root@my-server 'cd /my/remote/repo && && git pull origin master'

if you have remote control of your server.

Sign up to request clarification or add additional context in comments.

1 Comment

So I use my local (dev computer) as origin for the server, and pull from there? (I connect with ssh)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.