Is it possible to connect to private Github repositories using Plesk Git extension?

Follow

Comments

6 comments

  • Avatar
    Marek Kaczanowicz

    Hi, the connection is successful, but the auto-deployment seems to be not working from bitbucket...

     

    When I press the PULL UPDATES button - all OK, however, if I Commit to bitbucket, waiting few minutes and the repository is not populated automatically.

     

    What can be the reason of this?

    0
    Comment actions Permalink
  • Avatar
    Alexandr Redikultsev

    Hello, @Marek Kaczanowicz!

    In order to automate this process, web hooks should be used, see the following page for the details:

    https://docs.plesk.com/en-US/onyx/administrator-guide/website-management/git-support/using-remote-git-hosting.75848/#o76296 

    0
    Comment actions Permalink
  • Avatar
    Evangelos Sapountzis

    I am using this method mentioned here, but I am unable to connect. I always get the following error:

     

    Public key for the server at 'github.com' is already known in '/var/www/vhosts/new.domain.com/.ssh/git_known_hosts'.
    ssh: connect to host github.com port 49153: Connection timed out
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.

     

    Even if I try changing the SSH port to the default 22, I keep getting similar errors.

     

    Any suggestions?

    0
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Evangelos Sapountzis

    The cause of this behavior is not clear, but I can see that you have resolved it by deleting id_rsa, id_rsa.pub and known_hosts file from the .ssh folder, according to https://talk.plesk.com/threads/github-integration-errors-unable-to-pull-updates-from-the-remote-repository.354967/

    0
    Comment actions Permalink
  • Avatar
    Evangelos Sapountzis

    @... Yes, indeed. I managed to resolve it with the help of a Plesk support agent. And the solution is the one found on the link you posted. 

    0
    Comment actions Permalink
  • Avatar
    Christian Bonato

    For those who have problems to interact with their Github private repository,
    here's what worked for me (Plesk Obsidian 18.x).

     

    ———
    1. You don't need to create a SSH Key on Github.

    Instead, you're going to create a PAT (Personal Access Token) on Github.

    From your GitHub account, go to 
    Settings => 
    Developer Settings (*it's at the very bottom of the sidenav as of 2022-09-02) => 
    Personal Access Tokens => 
    Generate New Token (Give your password) => 
    Fillup the form (*see screencap below. Of course the comment is what you desire. For permissions, I checked 'repo' globally, I don't think you'll need any of the rest) =>
    click Generate token => 
    Copy the generated Token, it will be something like ghp_sFhFsSz52787sdTzMDreGRLjmks4Tzuzgthdvfsrta

     

    Make sure you copy-paste your token somewhere secure, as you won't be able to retrieve it if you lose it (you'll have to revoke it and create a new one).
    Your Token is now your "password"!

    ————

    2. Now go back to Plesk, go under your desired domain > Git,
    provide your github info (https path to repo, username)
    and copy your token inside the 'password' field.

    ———
    3. If you still have trouble in Plesk: once you have your Github Token,
    you'll have to SSH into your server,
    with a "System User" you create in Plesk,
    under your.domain > Web Hosting Access.
    Give this system user '/bin/bash' access (« Access to the server over SSH: »).

    Then, follow these StackOverflow instructions:
    Message "Support for password authentication was removed. Please use a personal access token instead."
    Of course, you'll need git installed on your server, but nowadays it usually already is.

    Open a SSH session, go inside your 'httpdocs' folder.
    You do not need to create a folder in 'httpdocs', git will create it named after your repo.

    Once you've successfully tested 'git pull', go back to Plesk (see step 2).

    Good luck!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request