To create a new Git repository for your domain, go to Websites &
Domains > Git. If you have already created Git repositories for
your domain via Plesk, click the Add Repository button. You will see
the screen for creating a new repository:
First, you have to select where your code is stored. In this scenario,
select Local repository on your workstation.
Git Repository in Plesk. Specify the repository name. By default,
the name of the domain is used with the .git suffix.
In the Your Website section, specify the following:
-
The deployment mode. By default, the Automatic deployment is
used. This means that all changes pushed to the Git repository will
be automatically deployed to the production site. If you want to
change the deployment mode, click the automatically deployed link
and select another option in the opened Deployment Mode window.
If Manual deployment is selected, you will need to manually
deploy files from the Git repository to your hosting. If No
deployment is selected, the files will not be deployed to the
production site (this may be used, for example, for code storing and
exchange). -
A target directory for publishing Git files on your website. By
default, the/httpdocs
directory is used. You can change it to
another existing directory by clicking the directory name.
Click OK. The new repository will be created and displayed on the
Git page.
The displayed repository URL depends on the data transfer protocol that
you use. You can select one of the following protocols:
- SSH (on Linux only) - This protocol is used by default if SSH web
hosting access is enabled for the domain. To set SSH access to the
domain, go to Websites & Domains > Web Hosting Access and in
the Access to the server over SSH menu select /bin/bash or
/bin/sh. In this case, the repository URL appears as
[email protected]:~/repos/example.git. - HTTPS - This protocol is used by default if SSH web access is
forbidden, and SSL/TLS is configured for a domain (Hosting
Settings>SSL/TLS support). In this case, the URL appears as
https://[email protected]/plesk-git/example.git. - HTTP - This protocol is used by default if SSH web access is
forbidden, and SSL/TLS is not configured for a domain. In this case,
a repository URL will appear as
http://[email protected]/plesk-git/example.git.
Follow the instructions available from the Help link to initialize
the local repository.
When the repository is initialized, you can see the commit information
and the active branch name at Websites & Domains > Git. By
default, the master branch is used to work with Plesk. You can add
more branches later (see the Change Branch or
Path section).
Now you can commit your web site files from your local repository and
push them to the server repository.