Finally I managed to set up the gitlab server on a virtual machine. The static IP is 192.168.xx.xx and I enter normaly from the browser to gitlab dashboar. Everything is fine until now.
I have also install the git on other web server and i created the git file so I can push the files directly to the 192.168.xx.xx(which is the gitlab platform).
I have generate the SSH keys(id_ed25519) and i have stored them in /c/users/admin/.ssh/. In this path I have
Also I copied the public key into my gitlab account so the SHA256 is the same both on web server and the gitlab account.
I have an issue and I cannot complete of what i'm doing because I'm facing a problem. When I run this command:
git clone git@192.168.xx.xx:root/sample.git
I get an error which is:
Cloning into 'sample'...
git@192.168.xx.xx: Permission denied (publickey).
fatal: Could not read from remote repository.
I have searh all over the internet and I saw that is a common issue but I have tried almost everything. Created files etc but nothing worked.
Also, I tried this command:
ssh-add /c/users/admin/.ssh/id_ed25519
Could not open a connection to your authentication agent.
What can I do?
I run
ssh -vT git@192.168.22.29 echo hello
OpenSSH_8.4p1, OpenSSL 1.1.1i 8 Dec 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.22.29 [192.168.22.29] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_rsa type 0
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_dsa type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519 type 3
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_xmss type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2
debug1: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.22.29:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:YR5gM1BDDcT+p3EO8yehb4k42PUBs9W9x0bBwIi1mSM
debug1: Host '192.168.22.29' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/Administrator.CITY-1/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_rsa RSA SHA256:PhxaREDKEGmjj2DYDvj+uAR/K1ns05O3S3JKgDMbvhQ
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_dsa
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519 ED25519 SHA256:POB8QvlHpnMO0R/ViOTjwxfRegLlmmBca4jWRCgn/Hk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/Administrator.CITY-1/.ssh/id_rsa RSA SHA256:PhxaREDKEGmjj2DYDvj+uAR/K1ns05O3S3JKgDMbvhQ
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_dsa
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk
debug1: Offering public key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519 ED25519 SHA256:POB8QvlHpnMO0R/ViOTjwxfRegLlmmBca4jWRCgn/Hk
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_xmss
debug1: No more authentication methods to try.
git@192.168.22.29: Permission denied (publickey).
==================================
After a research I forgot to paste the public key into authorized_keys. Now the previous command shows this :
OpenSSH_8.4p1, OpenSSL 1.1.1i 8 Dec 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.22.29 [192.168.22.29] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_rsa type 0
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_dsa type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519 type 3
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_xmss type -1
debug1: identity file /c/Users/Administrator.CITY-1/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2
debug1: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.22.29:22 as 'bitnami'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:YR5gM1BDDcT+p3EO8yehb4k42PUBs9W9x0bBwIi1mSM
debug1: Host '192.168.22.29' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/Administrator.CITY-1/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_rsa RSA SHA256:PhxaREDKEGmjj2DYDvj+uAR/K1ns05O3S3JKgDMbvhQ
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_dsa
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519 ED25519 SHA256:POB8QvlHpnMO0R/ViOTjwxfRegLlmmBca4jWRCgn/Hk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/Administrator.CITY-1/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/Administrator.CITY-1/.ssh/id_rsa RSA SHA256:PhxaREDKEGmjj2DYDvj+uAR/K1ns05O3S3JKgDMbvhQ
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_dsa
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Administrator.CITY-1/.ssh/id_ecdsa_sk
debug1: Offering public key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519 ED25519 SHA256:POB8QvlHpnMO0R/ViOTjwxfRegLlmmBca4jWRCgn/Hk
debug1: Server accepts key: /c/Users/Administrator.CITY-1/.ssh/id_ed25519 ED25519 SHA256:POB8QvlHpnMO0R/ViOTjwxfRegLlmmBca4jWRCgn/Hk
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.22.29 ([192.168.22.29]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: /home/bitnami/.ssh/authorized_keys:5: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/bitnami/.ssh/authorized_keys:5: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending command: echo hello
hello
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2616, received 2668 bytes, in 0.1 seconds
Bytes per second: sent 41858.5, received 42690.6
debug1: Exit status 0
exit status 0 which is ok. Now my problem is that I want to connect the .git with gitlab but when I type this command:
git clone git@192.168.22.29:user1/devnow.git
it shows a promt for password. I have field with all the passwords i used for this but without any good result. Also I want to reffer that I use bitnami with debian + gitlab together. I want to login to user1 through ssh in a result of give access to gitlab to see my local repository.
Try first a key without a passphrase, using a simpler rsa scheme, for testing
# register mykey.pub content to your GitLab profile
ssh -i ~/.ssh/mykey git@192.168.22.29
# check you see a Welcome message
If that does not work, try with a key using the old PEM format:
ssh-keygen -t rsa -m PEM -P "" -f ~/.ssh/mykey