I am facing an issue to clone a repository via SSH that I would appreciate some help.
We have 2 windows machines , one installed with Jenkins and the other with an Application that must have updates from git/Jenkins .
When executing the Jenkins job, the agent that is located in the Application server tries to clone the git repo we have in the Jenkins server.
The connection is via OpenSSH
I did the following commands (just to test locally without using Jenkins)
To create a test repo to be cloned:
Cloning directly to the folder location >
user@machine MINGW64 ~/testegit
$ mkdir aa2.git
user@machine MINGW64 ~/testegit
$ cd aa2.git/
user@machine MINGW64 ~/testegit/aa2.git
$ git init
Initialized empty Git repository in C:/Users/user/testegit/aa2.git/.git/
user@machine MINGW64 ~/testegit/aa2.git (master)
$ echo gyhsgudgu>>teste.txt
user@machine MINGW64 ~/testegit/aa2.git (master)
$ git add teste.txt
warning: in the working copy of ‘teste.txt’, LF will be replaced by CRLF the next time Git touches it
user@machine MINGW64 ~/testegit/aa2.git (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use “git rm --cached …” to unstage)
new file: teste.txt
user@machine MINGW64 ~/testegit/aa2.git (master)
$ git commit -m “teste”
[master (root-commit) 6fe2d8c] teste
1 file changed, 1 insertion(+)
create mode 100644 teste.txt
Cloning direct to the folder in the same machine works perfectly, of course:
user@machine MINGW64 ~/Documents/work/AA/cicd/teste
$ git clone ~/testegit/aa2.git
Cloning into ‘aa2’…
done.
But using a SSH connection:
user@machine MINGW64 ~/Documents/work/AA/cicd/teste
$ git clone ssh://127.0.0.1/testegit/aa2.git
Cloning into ‘aa2’…
user@127.0.0.1’s password:
fatal: ‘’/testegit/aa2.git’’ does not appear to be a git repository
fatal: Could not read from remote repository.
The SSH is working fine.
user@machine MINGW64 ~/Documents/work/AA/cicd/teste
$ ssh localhost dir
Shows the entire folder
I have already tried mutiples sintaxes in the address with slash, backslash, ~, full path, but the same error everytime:
git clone ssh://127.0.0.1/testegit/aa2.git
git clone ssh://127.0.0.1/~/testegit/aa2.git
git clone ssh://127.0.0.1/~\testegit\aa2.git
git clone ssh://127.0.0.1/~\testegit\aa2.git
git clone ssh://127.0.0.1/testegit\aa2.git
git clone user@127.0.0.1:testegit\aa2.git
git clone ~/testegit/aa2.git
git clone user@locahost:~/testegit/aa2.git
git clone user@localhost:~/testegit/aa2.git
git clone user@localhost:~/testegit/aa2.gi
git clone user@localhost:~\testegit\aa2.git
Does anyone have experienced that ?
Could be some permission for the SSH service? I checked the folder and seems to be ok