1

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...

  • are you able to clone the repo? What OS are you using, what directory do you have your ssh keys in (default git looks at is usually /username/.ssh on windows) – Goku Jan 28 '22 at 19:39
  • @goku Not able to clone. Error: "remote: HTTP Basic: Access denied remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP. remote: You can generate one at https://gitlab.stud.idi.ntnu.no/-/profile/personal_access_tokens fatal: Authentication failed for 'https://gitlab.stud.idi.ntnu.no/eriskjel/junit-test.git/'". Using Windows. My keys are in /username/.ssh – Erik Skjellevik Jan 28 '22 at 20:01
  • @goku I also tried to clone using SSH, instead of HTTPS, and got this error: "Cloning into 'junit-test'... 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." – Erik Skjellevik Jan 28 '22 at 20:14
  • Possibly a duplicate of https://stackoverflow.com/questions/56810990/gitlab-error-connect-to-host-gitlab-com-port-22-connection-timed-out – Katrin Leinweber Jan 28 '22 at 20:26
  • Did you add to the SSH agent on your local client? This is the app that is usually responsible for supplying your keys to the various apis that use them, at least on Linux. – Nate T Jan 29 '22 at 07:56

2 Answers2

1

when asked to enter a passphrase, my cmd would not take any input other than enter

This may be your terminal not showing which or how many characters you type your password.


About the SSH timeout: What does GitLab's connection Verification output for your GitLab server (probably ssh -Tvvv git@gitlab.stud.idi.ntnu.no)?

On that page further up, there is also advice on how to set your ~/.ssh/config file. If your GitLab admins configured a different SSH, please ask them for details, or check their documentation for advice.

Katrin Leinweber
  • 1,316
  • 13
  • 33
  • Got this error: "debug3: Failed to open file:C:/Users/eriks/.ssh/config error:2 debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2 debug2: resolving "gitlab.stud.idi.ntnu.no" port 22 debug2: ssh_connect_direct debug1: Connecting to gitlab.stud.idi.ntnu.no [129.241.162.52] port 22. debug3: finish_connect - ERROR: async io completed with error: 10060, io:000001C294182D20 debug1: connect to address 129.241.162.52 port 22: Connection timed out ssh: connect to host gitlab.stud.idi.ntnu.no port 22: Connection timed out" For the record - I do not have a config file in \.ssh – Erik Skjellevik Jan 28 '22 at 20:48
  • When I try the `-Tvvv` from my machine, I get _only_ the timeout, not the `async io completed with error`. [This other post](https://superuser.com/questions/1479014/ssh-from-windows-at-my-house-to-school-linux-server) was resolved by admin intervention. Since you are getting a timeout, I would also think that your local admins will know best how to solve this. – Katrin Leinweber Jan 28 '22 at 21:00
  • I will try to open dialouge with the admins regarding this, thankyou. Side note: Should I have a config file in my /.ssh? – Erik Skjellevik Jan 28 '22 at 21:07
  • @ErikSkjellevik Not necessarily, considering your SSH key pair used a default name. But if the SSH egress is blocked (as it is often the case in a corporate environment, as [I mentioned before](https://stackoverflow.com/a/56815448/6309)), you will have to use an HTTPS URL instead. – VonC Jan 28 '22 at 21:19
  • I see, kinda. I have tried cloning and pushing using this HTTPS url "https://gitlab.stud.idi.ntnu.no/eriskjel/junit-test.git", if that was what you were referring to. This did not work either, however I got a different error: "Cloning into 'junit-test'... remote: HTTP Basic: Access denied remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP. remote: You can generate one at https://gitlab.stud.idi.ntnu.no/-/profile/personal_access_tokens fatal: Authentication failed for 'https://gitlab.stud.idi.ntnu.no/eriskjel/junit-test.git/'" – Erik Skjellevik Jan 28 '22 at 21:30
0

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.