It is often that we started a project in our local laptop, and we want this project secured in our server. I know, it may not possible to execute git clone command from server to clone the project from your local computer due to firewall or at that moment your laptop does not have public IP like your server does.

Before pushing the project to server, I assumed that we have created git repository in the server:

$ mkdir projectname.git
$ cd projectname.git
$ git init --bare

Or just:

$ git init --bare projectname.git

From our local, execute these command to push the git local repository to the server:

$ git remote add origin ssh://user@server.com:port/path/to/projectname.git
$ git push origin master

Now we have our project safe in the server. We can safely continue our work in local laptop, we can clone to other laptop if required, and push the changes to server anytime we want.