Hello everyone,
I am trying to setup my windows machine to use my Gitlab account with Windows11. My main IDE will be VSCode, but I will also work on projects without proper API (PCB design for example). On my Ubuntu machine (different machine) there was no problem with the installation using the ssh method.
My steps:
- Generate key using ssh-keygen -t ed25519 -C “myemail@gmail.com”
- File id_ed25519 and id_ed25519.pub generated in ~/user/.ssh
- Add key to Gitlab account → no error
- Added config in .ssh
# GitLab.com
Host gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
- Started openSSH in Windows services
- Restart cmd and powershell
- Trying ssh -vT git@github.com → Permission denied
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Reading configuration data C:\\Users\\me/.ssh/config
debug1: Connecting to github.com [140.82.121.3] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\me/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\me/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\me/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\me/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_ed25519 type 3
debug1: identity file C:\\Users\\me/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_ed25519_sk type -1
debug1: identity file C:\\Users\\me/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\me/.ssh/id_xmss-cert type -1
debug1: identity file C:\\Users\\me/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\me/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.5
debug1: Remote protocol version 2.0, remote software version 48ecf9ce5
debug1: compat_banner: no match: 48ecf9ce5
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen C:\\Users\\me/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
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: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:+DisF/zLDA0zJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
debug1: load_hostkeys: fopen C:\\Users\\me/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'github.com' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\me/.ssh/known_hosts:1
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: agent returned 1 keys
debug1: Will attempt key: C:\\Users\\me/.ssh/id_ed25519 ED25519 SHA256:H093dEt0tQIChoPDpaxXaH093dEt0tQIChoPDpXimoo agent
debug1: Will attempt key: C:\\Users\\me/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\me/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\me/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\me/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\me/.ssh/id_xmss
debug1: Will attempt key: C:\\Users\\me/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\me/.ssh/id_ed25519 ED25519 SHA256:H093dEt0tQIChoPDpaxXaH093dEt0tQIChoPDpXimo agent
debug1: Authentications that can continue: publickey
debug1: Trying private key: C:\\Users\\me/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\me/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\me/.ssh/id_ecdsa_sk
debug1: Trying private key: C:\\Users\\me/.ssh/id_ed25519_sk
debug1: Trying private key: C:\\Users\\me/.ssh/id_xmss
debug1: Trying private key: C:\\Users\\me/.ssh/id_dsa
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).
I tried following solutions from Stack and [serverside] with no luck.
In the meantime I can still work on my Win-machine using push via the source control from VSCode, even if the credentials are wrong. I followed the steps from Use SSH keys to communicate with GitLab | GitLab Docs and added a “user.name” and “user.email” when VSCode suggested it after cloning an example project. I was also able to push a new commit after providing wrong credentials when prompted. This seems to be an issue using the cloning method with htttps or, more likely, an unsafe connection to my repository. I dont think the problem is related with my ssh-issue, but maybe my whole Win11-Gitlab configuration is already unsafe. VSCode asks me twice for the username and password of gitlab and even wrong inputs allow me to push the project.
2025-03-02 17:30:03.726 [info] > git config --get --local branch.main.merge [41ms]
2025-03-02 17:30:07.722 [info] > git config --get commit.template [43ms]
2025-03-02 17:30:07.750 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [54ms]
2025-03-02 17:30:07.808 [info] > git status -z -uall [43ms]
2025-03-02 17:30:07.810 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [43ms]
2025-03-02 17:30:09.113 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z --shortstat --diff-merges=first-parent -n50 --skip=0 --topo-order --decorate=full --stdin [44ms]
2025-03-02 17:30:09.813 [info] > git add -A -- . [62ms]
2025-03-02 17:30:10.325 [info] > git show --textconv :.git/COMMIT_EDITMSG [47ms]
2025-03-02 17:30:10.325 [warning] [GitFileSystemProvider][readFile] File not found - git: ~\myrepo/.git/COMMIT_EDITMSG.git?%7B%22path%22%3A%22d%3A%5C%5CNOD%5C%5CFirmware%5C%5Cmyrepo%5C%5C.git%5C%5CCOMMIT_EDITMSG%22%2C%22ref%22%3A%22%22%7D
2025-03-02 17:30:10.326 [info] > git ls-files --stage -- ~\myrepo\.git\COMMIT_EDITMSG [46ms]
2025-03-02 17:30:10.326 [warning] [GitFileSystemProvider][stat] File not found - git: ~\myrepo/.git/COMMIT_EDITMSG.git?%7B%22path%22%3A%22d%3A%5C%5CNOD%5C%5CFirmware%5C%5Cmyrepo%5C%5C.git%5C%5CCOMMIT_EDITMSG%22%2C%22ref%22%3A%22%22%7D
2025-03-02 17:30:12.311 [info] > git blame --root --incremental 19461275dbde247c2cf627c44100b03759279049 -- ~\myrepo\.git\COMMIT_EDITMSG [41ms]
2025-03-02 17:30:12.311 [info] fatal: no such path .git/COMMIT_EDITMSG in 19461275dbde247c2cf627c44100b03759279049
2025-03-02 17:30:16.901 [info] > git -c user.useConfigOnly=true commit --quiet [7087ms]
2025-03-02 17:30:16.951 [info] > git config --get commit.template [46ms]
2025-03-02 17:30:16.954 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [45ms]
2025-03-02 17:30:16.995 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [37ms]
2025-03-02 17:30:16.996 [info] > git status -z -uall [40ms]
2025-03-02 17:30:17.103 [info] > git merge-base refs/heads/main refs/remotes/origin/main [103ms]
2025-03-02 17:30:17.106 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z --shortstat --diff-merges=first-parent -n50 --skip=0 --topo-order --decorate=full --stdin [94ms]
2025-03-02 17:30:17.106 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [87ms]
2025-03-02 17:30:17.106 [info] > git config --get commit.template [89ms]
2025-03-02 17:30:17.107 [info] > git show --textconv :gittest/main.cpp [48ms]
2025-03-02 17:30:17.107 [info] > git ls-files --stage -- ~\myrepo\gittest\main.cpp [45ms]
2025-03-02 17:30:17.153 [info] > git diff --name-status -z --diff-filter=ADMR 19461275dbde247c2cf627c44100b03759279049...refs/remotes/origin/main [47ms]
2025-03-02 17:30:17.157 [info] > git cat-file -s f2175470e91c3c686723fbf9e7e3a7e0fa7fb47d [47ms]
2025-03-02 17:30:17.167 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [50ms]
2025-03-02 17:30:17.168 [info] > git status -z -uall [54ms]
2025-03-02 17:30:17.206 [info] > git blame --root --incremental 3edd517e24940ba775cc483860894202c1599cae -- ~\myrepo\gittest\main.cpp [39ms]
2025-03-02 17:30:18.345 [info] > git log --oneline --cherry main...main@{upstream} -- [39ms]
2025-03-02 17:30:19.631 [info] > git ls-files --stage -- ~\myrepo\gittest\main.cpp [39ms]
2025-03-02 17:30:19.666 [info] > git cat-file -s f2175470e91c3c686723fbf9e7e3a7e0fa7fb47d [33ms]
2025-03-02 17:30:19.723 [info] > git show --textconv :gittest/main.cpp [53ms]
2025-03-02 17:30:20.098 [info] > git pull --tags origin main [1749ms]
2025-03-02 17:30:20.098 [info] From https://gitlab.com/myuser/myrepo
* branch main -> FETCH_HEAD
2025-03-02 17:30:21.358 [info] > git ls-files --stage -- ~\myrepo\gittest\main.cpp [34ms]
2025-03-02 17:30:21.413 [info] > git cat-file -s f2175470e91c3c686723fbf9e7e3a7e0fa7fb47d [53ms]
2025-03-02 17:30:21.452 [info] > git show --textconv :gittest/main.cpp [36ms]
2025-03-02 17:30:23.565 [info] > git ls-files --stage -- ~\myrepo\gittest\main.cpp [130ms]
2025-03-02 17:30:23.605 [info] > git cat-file -s f2175470e91c3c686723fbf9e7e3a7e0fa7fb47d [37ms]
2025-03-02 17:30:23.645 [info] > git show --textconv :gittest/main.cpp [37ms]
2025-03-02 17:30:33.725 [info] > git config --get --local branch.main.merge [38ms]
2025-03-02 17:30:47.685 [info] > git push origin main:main [27584ms]
2025-03-02 17:30:47.685 [info] To https://gitlab.com/myuser/myrepo.git
1946127..3edd517 main -> main
Everything up-to-date
Everything up-to-date
Everything up-to-date
Everything up-to-date
remote: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. If a token was provided, it was either incorrect, expired, or improperly scoped. See https://gitlab.com/help/topics/git/troubleshooting_git.md#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/myuser/myrepo.git/'
2025-03-02 17:30:47.742 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [50ms]
2025-03-02 17:30:47.743 [info] > git config --get commit.template [47ms]
2025-03-02 17:30:47.790 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [41ms]
2025-03-02 17:30:47.792 [info] > git status -z -uall [45ms]
2025-03-02 17:30:47.859 [info] > git merge-base refs/heads/main refs/remotes/origin/main [62ms]
2025-03-02 17:30:47.873 [info] > git log --format=%H%n%aN%n%aE%n%at%n%ct%n%P%n%D%n%B -z --shortstat --diff-merges=first-parent -n50 --skip=0 --topo-order --decorate=full --stdin [64ms]
2025-03-02 17:30:47.899 [info] > git diff --name-status -z --diff-filter=ADMR 3edd517e24940ba775cc483860894202c1599cae...refs/remotes/origin/main [36ms]
2025-03-02 17:31:03.727 [info] > git config --get --local branch.main.merge [40ms]
Since I wanted to push without using my right/wrong credentials I wanted to switch to the ssh method.
Does anyone spot the problem in the logs?