git-sync asking for password even while using ssh-key-file
rishabhgargg opened this issue · 3 comments
With the following docker command:
docker run -it --rm -v $PWD/git-sync-essentials:/work -w /work -v $PWD/git-sync-cloned:/git-sync-cloned -v $PWD/destination:/destination --entrypoint sh registry.k8s.io/git-sync/git-sync:v3.6.9
Note: git-sync-cloned
, git-sync-essentials
, destination
all have ownership user:group as 65533:65533
I am running the git-sync:v3.6.9
container on my machine. Inside it, when I am executing following command:
/git-sync -ssh -v=2 -ssh-key-file=/work/id_rsa -ssh-known-hosts=false -dest=/destination -root=/git-sync-cloned -repo=git@<repo_url>
With this setup, I am getting the following error, I have tried it multiple time, but this doesn't seem to work.
docker run -it --rm -v $PWD/git-sync-essentials:/work -w /work -v $PWD/git-sync-cloned:/git-sync-cloned -v $PWD/destination:/destination --entrypoint sh registry.k8s.io/git-sync/git-sync:v3.6.9
$ /git-sync -ssh -v=2 -ssh-key-file=/work/id_rsa -ssh-known-hosts=false -dest=/destination -root=/git-sync-cloned -repo=git@gitlab.<example>.com:<username>/<repo>.git
I1103 18:15:17.203508 7 main.go:401] "level"=0 "msg"="starting up" "pid"=7 "args"=["/git-sync","-ssh","-v=2","-ssh-key-file=/work/id_rsa","-ssh-known-hosts=false","-dest=/destination","-root=/git-sync-cloned","-repo=git@gitlab.<example>.com:<username>/<repo>.git"]
I1103 18:15:17.207993 7 main.go:1187] "level"=1 "msg"="setting up git SSH credentials"
I1103 18:15:17.208033 7 main.go:539] "level"=1 "msg"="syncing repo"
I1103 18:15:17.208060 7 main.go:952] "level"=0 "msg"="cloning repo" "origin"="git@gitlab.<example>.com:<username>/<repo>.git" "path"="/git-sync-cloned"
git@gitlab.<example>.com's password:
Do note that, I have used the same key to clone the repo without the git-sync container on my local machine on a fresh ubuntu container and it worked as expected, but I don't know why I am facing issues with this git-sync container.
I don't know that even when I am passing the ssh key, why is it asking me for password, I am stuck here for past 3 days now.
@thockin Any help is appreciated. Thanks in advance.
-
Can you run with
-v 6
and show the logs? -
If you manually run
git clone <repo>
with the exact repo syntax, what happens? -
If you can try v4.1.0 that would also help (soem flags have changed between v3 and v4, there's a doc)
The issue was regarding the port, as git sync over ssh uses port 22 (as expected), and it was blocked in my infrastructure and becuase of that reason, even when I supplied the ssh key, it was falling back to https (443).
Thank you for your response.
Thanks for the update!