Nyalum Lacey
Nyalum Lacey

Reputation: 143

How to clone more than one private repository on CPanel

I am having some issues cloning a private repo into my CPanel server, because of a previously cloned private GitHub repository. I have cloned it before using ssh access and everything went right. However, I need to clone another repo that is also private and using ssh access, as well.

I followed all the procedures to copy the private repo into CPanel as the previous one. However, I'm having issues with access rights, getting the same message as following:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Is there a way to clone two private repositories with different ssh keys? how to clone those repositories without getting the same message above?

Thanks in advance.

------------------------------------------------- EDIT-----------------------------------------------------

My config file in the .ssh folder is the following

Host region_admin
  HostName <[email protected]:SthefanyRangel/regionadmin.git>
  User [email protected]:2083
  IdentityFile ~/.ssh/id_rsa

Host renovafacil
  HostName <[email protected]>
  User [email protected]:2083
  IdentityFile ~/.ssh/id_rsa.rf
  
Host regionadmin-ra2
  HostName <[email protected]>
  User git
  IdentityFile ~/.ssh/region_admin

Where my attempts to connect to the second account are the last record.

Upvotes: 1

Views: 467

Answers (1)

VonC
VonC

Reputation: 1327706

After reading the documentation "CPanel / How to Copy an Account with SSH Keys", you might need a second key if the GitLab repository uses the same account than the first one.

If not, try:

git -c core.sshCommand='ssh -Tv' clone git@github:...

That will give you an idea of which keys are considered. If your second key is not with a default name, it would need a ~/.ssh/config in order to specify it.

You can test a config entry with:

ssh -T region_admin

Note: Hostname is always just the hostname, not <[email protected]:SthefanyRangel/regionadmin.git>

Your first ~/.ssh/config entry should therefore be (for the actual GitHub username, for which the public SSH key has been registered):

Host region_admin
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa

Then:

cd /path/to/regionadmin
git remote set-url origin region_admin:SthefanyRangel/regionadmin.git

Upvotes: 1

Related Questions