• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Question git pull from Github

Symer

New Pleskian
Server operating system version
Debian 11.9
Plesk version and microupdate number
Plesk Obsidian 18.0.60 Mise à jour 1
Hello everyone.
I'm new to my git / github.
I managed to install git on my PC, push to Github and have github send the information (webhook) to Plesk so that it pulls the commit.

But I have a question, is it possible to pull the FTP content that is present on Plesk from Github?

Indeed, I have a Prestashop site and sometimes if a module does not work the developer intervenes directly on the FTP. So I would like to pull his modifications to be able to see what he did and keep files up to date on Github?

Thanks in advance.

PS: Sorry for my English, it is translated from google translate.
 
The GIT extension can only be used to Pull from a remote repository (like Github).

If I understand correctly you sometime upload files manually to your website and want to Commit and Push those changes to your repository on Github? The GIT extension does not support Commits and Pushes. But you can do that via command line.
 
You understood my need exactly.
Would you have any information to send me on how to do this from the command line please?
 
Sure, but I highly recommend to create test repository in GitHub and add a test domain to Plesk to familiarize yourself with the Git command before you use any of these commands on your production site! Because if something goes wrong you might accidently break your website or mess-up your repository.

If you use the build-in Plesk SSH-terminal you use these commands. First get the name of the directory of your repository. In this example it's my-repo.
Schermafbeelding 2024-05-15 183533.png
Replace my-repo with your repository name in the commands bellow. Also I assume your repository has been deployed to the default document root directory (httpdocs). If it isn't change that too in the example bellow.

You probably first have to configure the user identity for your repository. Which you can do using these two commands:
Code:
git --git-dir=git/my-repo.git/ config user.email "[email protected]"
git --git-dir=git/my-repo.git/ config user.name "Your Name"

With the command below you add all new files in to the commit.
Code:
git --git-dir=git/my-repo.git/ --work-tree=httpdocs add --all

Next you commit the changes to repository with a message (replace commit message with your own message) and push the changes your remote repository.
Code:
git --git-dir=git/my-repo.git/ --work-tree=httpdocs commit -am "commit message"
git --git-dir=git/my-repo.git/ --work-tree=httpdocs push
 
Hello, thank you, it’s great, I’m going to try that.
To push to my remote repository, I add the url to this command?

git --git-dir=git/my-repo.git/ --work-tree=httpdocs push remote_repository ?
 
These commands only work if you have previously deployed your remote repository in Plesk. Your remote repository URL will be stored in the repository configuration. So no need to add the URL to any commands.
Schermafbeelding 2024-05-17 192326.png
 
Back
Top