Search code examples
gitsshserverphpstorm

How can I push a git repo to a remote server through ssh?


I have a remote server which I can access through SSH. How can I push my local git repo there? The server doesn't have git installed, I want to do everything from my IDE (PhpStorm)

So far the only solution for me is to sync the local repo's directory with the one on the remote server with WinSCP but that's messy and I don't want another application for a job what git supposed to do.


Solution

  • Indeed, the remote server needs to have .git installed. There is no way around it!

    If the server has .git installed, you can add a remote repository from your local machine. You can do this by typing git remote add branchname [email protected]/path/to/your/repo.git into your terminal.

    This command will connect your local repository to your remote server, where your website is sitting. No need for a git account.

    This guy explains it really well.

    https://www.youtube.com/watch?v=9qIK8ZC9BnU