Can't see any posts that address this specific question so here goes...
I have a git repo on a vps. the repo tracks a website (contained in public_html
) and also directories needed by that website (ie private
, tmp
, etc.). Like this:
drwxr-xr-x 8 someuser someuser 4096 Jan 17 07:00 .git/
drwxrwx--- 5 someuser www-data 4096 Jan 17 07:00 private/
drwxr-x--- 10 someuser www-data 4096 Jan 17 07:00 public_html/
drwxrwx--- 2 someuser www-data 4096 Jan 17 07:00 tmp/
as such, this repo is above the web root, not publicly accessible. ssh with key only access is set up on this linux system.
I want to clone this remote git repo via ssh to my local machine. How?
I have tried git clone ssh://user@ipaddress:22/path/to/repo .
but I get:
Cloning into '.'...
Permission denied (publickey).
fatal: Could not read from remote repository.
I don't understand why this is because my ssh config file correctly specifies the IdentityFile
and Hostname
and normal ssh works fine with these settings.
Any ideas? Thanks.
Setting the environment variable GIT_TRACE
to something else than 0 will make git output the expansion of aliases, and delegation to other sub-programs.
This will allow you to see the exact command git uses to ssh to your remote machine.
In any case, here, the message is pretty clear: Permission denied (publickey).
This comes from ssh for sure, so if a normal ssh works fine, you need to find the difference between what you call a normal ssh and, the ssh that git is executing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.