I'm not entirely sure from the way the question was phrased, but it sounds to me like you might be experiencing some trouble moving from a non distributed version control system (svn, csv, etc.) to a distributed one like git.
As it turns out, you get the functionality you want for free in Git! Simply clone your git repo to the computer you want to work from (
git clone <remote-repo>), work as normal (code, git add, git commit, rinse and repeat), and then push back to the remote repo when you're done and have a working internet connection (
git push origin master or whatever your remote / branch is called if you didn't go with the defaults). Git downloads a full copy of the repo, including all history, by default; so not having an internet connection shouldn't matter. You can just keep working and sync up with your remote machine when the internet comes back on.
If you're looking for a way to automatically push every time a commit is made, check out git hooks. The post commit hook is probably what you want. Just navigate to the
.git/hooks directory inside your git repo and rename the file
post-commit, or create it and make sure it's executable (
chmod +x post-commit) if it doesn't exist. Now anything you put into this script will be executed right after you make a commit, for instance, you seem to want:
git push origin master
You could also use the
post-receive hook on the remote machine to do something every time it receives a push from your local repo.
EDIT: In a comment you stated that "pushing manually won't work"; however, git supports pushing via SSH, which is probably how you're managing your server anyways. If not, it can also push via FTP (shudder) and other protocols including HTTP[S] if you configure your server properly. You should probably look into using git this way, as this is how it was designed to be used.