How to Add Remote with Git Gui?

isurfbecause picture isurfbecause · Jul 16, 2012 · Viewed 9.9k times · Source

I want to push my changes to a folder on a remote server. I can even do a map drive to it. Wish there was a folder browser (the same as choosing where to create repo) where I can select the server folder I want to push to. Since there isn't I know I have a syntax error here.

enter image description here

Answer

Adam Dymitruk picture Adam Dymitruk · Jul 16, 2012

Adding a remote has nothing to do with the physical remote itself. It is only for management of references to remotes themselves.

That being said, it sounds like you want to use Git to deploy to a server. You can use pushing of a branch to attain this. However, you first must have the remote setup via running this on the server

git clone --bare //path/to/your/repo /some/dir/on/the/server/.git

Now you must add a hook to this repo to fire every time you push to a branch. Within this hook you would:

git --git-dir=/some/dir/on/the/server/.git --work-tree=/where/to/deploy/to checkout deployment-branch -- .

You'll have to google git update hook to get the few lines of code needed to wrap the above line.