问题
I'm trying to add a private git repo onto cPanel but have ran into permission issues and not sure where I'm going wrong
I have generated the SSH keys in cPanel at the 'SSH Access' section. I then added the key onto the private repo in git at the 'Deploy keys' section.
But when I try to clone the repo on cPanel I get the error:
Error: “/usr/local/cpanel/3rdparty/bin/git” reported error code “128” when it ended: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I'm trying to clone with SSH git@github.com:myusername/myrepo.git
Have I done something wrong or missed a step?
回答1:
CLONE GITHUB REPOSITORY TO CPANEL STEPS
steps 1. Cpanel -> SSH Access -> Generate New Key(without enter pasword)->after generated key go to under public key-> manage-> authorize (make authoize) -> back, now view/download-> copy key
Step 2. Go Github-> https://github.com// -> Settings(repository setting) ->Deploy Keys (rights side)-> add deploy key (give title,and add key)-> done
Step 3. Go to Cpanel -> Git™ Version Control -> clone url : git@github.com:/<private_repository_name>.git
git@github.com:<user_name>/<repository_name>.git
-> give_repository_path
-> give_ repository_name
-> create
Step 4. manage repository from list-> Manage -> pull or deploy from Github -> Click on Update from Remote: works perfectly(any files edit or delete you fetch/pull from GitHub now)
回答2:
did you get to the bottom of this I was experiencing the same after removing the pass phrase from the key it worked
回答3:
After many hours i find this solution and it solved
My problem was caused by the way cPanel generates ssl keys. When you create a key cPanel, forced you to insert a passphrase. But GitLab is not compatible with such a key apparently.
The solution was to create the key on the local machine and import it to cPanel. Passphrases are for extra security when the key is stolen
as @vladmacovi said and i test it in my cpanel and its work
1- login to cpanel and gitlab
2- goto https://gitlab.com/profile/keys
3- Paste your public SSH key, which is usually contained in the file '~/.ssh/id_ed25519.pub' or '~/.ssh/id_rsa.pub' and begins with 'ssh-ed25519' or 'ssh-rsa'. Don't use your private SSH key.
4- create a key with this command:
ssh-keygen -t rsa -b 2048 -C "your.email@gmail.com"
5- this command create pub file and ppk file so you can open content of pub file.
6- goto cpanel /frontend/paper_lantern/version_control/index.html#/list/
create a new git repo then click on ssh then from: /frontend/paper_lantern/telnet/index.html
like this picture:
7- cleck on import key from : /frontend/paper_lantern/telnet/keys/importkey.html
then paste your key
please dont type anything in Passphrase box
8- then click on import button then authorized it
9- configure git form like this picture
回答4:
I have found an issue with the SSH key import within cPanel, when I import a private key via the cPanel SSH Key web interface it creates the file but includes the characters ^M
as line breaks.
When I edited the file via SSH and copied the original key from my desktop the Git operation via cPanel worked straight away.
Solution
Edit the private key after import and ensure there are no line-ending or other stray characters.
来源:https://stackoverflow.com/questions/54365121/adding-private-git-repo-via-cpanel