Search code examples
gitsshgitlabssh-keysgit-push

Failing to push origin to GitLab


Having a hard time learning how to push my Git repository to gitlab. Currently getting this error:

ssh: connect to host gitlab.stud.idi.ntnu.no port 22: Connection timed out fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I (think I) have connected my SSH on the gitlab website. However I did have some issues on that end too, and I'm therefore unsure whether I did everything right. Most notably when asked to enter a passphrase, my cmd would not take any input other than enter, so I guess I don't have one (or one was generated idk.) EDIT: Managed to change my private SSH keys passphrase. When trying to change the public one, it gives bad permissions error.

I have two files in my .ssh folder: "id_ed25519" and "id_ed25519.pub". And on GitLab, my ssh key is registered. But I don't understand whats stopping me from pushing my git testing rep to GitLab...


Solution

  • I got it to work, eventually, the issue was regarding my univerisity recently started using 2FA which meant I could not use HTTPS to connect to GitLab. Therefore I had to use SSH, which I already had set up, but most importantly I had to be on the schools network, either physically or by using a VPN. Fortunataly, I had the VPN, and managed to push my test-project to my project on GitLab.