Gitman: When Plesk meets Git

It doesn’t matter if we develop a tiny website or a huge web portal – someday we have to deploy it to a public web server. Our noble ancestors used to deploy their web projects via FTP or, if they were concerned about security, SFTP. These simple and reliable tools serve us well to this day. But at the same time, today there are more interesting ways for deployment. One of these ways is pushing to a remote git repo, or simply “push-to-deploy”.

“Push-to-deploy” is very popular and is supported by various services like GitHub, Heroku, Google Cloud Platform, and so on.
Today, I am happy to announce “push-to-deploy” support in Plesk.

Prerequisites

The first thing that is obviously required for “push-to-deploy” is Plesk. I prefer the just released 12.5 version, but 12.0 is also supported. The second, also unsurprising, is Git. And, last but not least, our new amazing Gitman extension, which does almost all the work.

It doesn’t make sense to describe Plesk installation here because it is well documented on official site.

The procedure for Plesk Git installation depends on the used Linux distro (by the way, the Windows version is not supported).

For Debian based distros run:

apt-get install git

and for Red Hat based distros run:

yum install git

The Gitman extension can be easily installed via the Plesk user interface (Left Menu -> “Server Management” -> “Extensions” -> “Extensions Catalog”).

Gitman extension inside Plesk extensions catalog

I suppose you already have a domain on which to deploy your web project, but if you don’t, you should create one.
There is one more thing you should do before we start: enable ssh access to the domain. It can be done from the “Web Hosting Access” menu on your domain settings screen. Simply change “Access to the server over SSH” from “Forbidden” to “/bin/bash”. Note: you must have the appropriate permission to do this.

Let’s check what you need:

  • Plesk installed
  • Git installed
  • Domain created
  • SSH access to domain allowed

Push-To-Deploy

First, you should initialize a new git repo for the domain on your server. To do this, open the “Websites and Domains” tab and click the “Git” button. On the page that opens, click the “Initialize” button.

Plesk Git - Initialize

After the repository is initialized, you can clone it to your local PC via the provided repository URL, commit files, and push them to the server repository.

Plesk Github - commit and push to server repo

Advanced Features

Custom deployment directory

By default, Gitman deploys the repository to the httpdocs directory of the domain. It can be easily changed via the “Settings” button. You should use an existing directory to be able to deploy.

Temporarily Turning Off Auto Deployment

Auto deployment can be temporarily turned off with the “Deactivate” button and turned on again with the “Activate” button. If auto deployment is turned off, Gitman will not perform any deployment automatically. But you can always perform manual deployment via the “Deploy” button.

Deploy from a different branch

You can select a branch for deployment, but first you should create it and push it to the server’s repository.

Plesk Github - deploy

First time you have to deploy by hand, but next time auto deployment will work as usual.

Removing a repository

There is a special “Remove” button to completely remove the current repository. It doesn’t remove any deployed files. After removing, you can initialize the repository again anytime.

Conclusion

Currently, the Gitman extension provides the basic functionality for site deployment and Git repository management. There are many possible enhancements and improvements. Feel free to share your experience and ideas with us.

12 Comments

  1. Hi! I’m trying to do it but I have this message:
    Proweb@Web_prog MINGW64 /c/wamp/www/test
    $ git clone ssh://XXX
    Cloning into ‘XXX’…
    ssh: Could not resolve hostname XXX: Name or service not known
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights and the repository exists.

    I have just installed git on windows 10 and gitman on plesk. I’m sure I need to do something more, but I have no idea. Can someone help me? Thanks!

  2. hi, is there any chance for this deployment utility to ignore certain config files from different users? so let’s say there’s a config.php file somewhere and I don’t want that file deployed every time i click “deploy” ?

    • Hello!
      The utility deploys all files from repository without any exceptions.
      If you don’t want to deploy some file, just don’t put it in the repo.

  3. Hello!
    Is it possible to show the Git option only to users whose hosting plan allows ssh access, or to control who sees the Git option in any other way?

  4. What if you are using the plesk preview URL? I don’t yet have the DNS propagated for my subscriptions domain?

  5. Is it possible to add multiple users to the repository?

  6. Which GUI products would you suggest ? I would like to avoid having a GitHub account so it must support remote connections which github desktop does not

  7. How can i initiate a git repo in an existing project on the server? ordinary case to push real server files to git…

Add a Comment

Your email address will not be published. Required fields are marked *

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base