While Creating Repository for Projects

While creating repository for projects we have some issues like:-

  1. if we use existing folder in same git server, we got error look like:-

git push -u origin master
ssh: connect to host gitlab.com port 22: Connection refused
fatal: The remote end hung up unexpectedly

  1. If we use exiting folder in our local system,error looks like:-

git push -u origin master
permission denied (public key)
fatal: The remote end hung up unexpectedly

@kusuresh

Have you uploaded your ssh key to your GitLab profile?

To confirm, just run ssh -T git@gitlab.com

You should get an output similar to Welcome to GitLab, Kelvin Mutuma!

SSH key uploaded in Git repository.

And pls find the below output as mentioned:

ssh -T git@gitlab.com
ssh: connect to host gitlab.com port 22: Connection refused

Maybe your network firewall blocks ssh access. Please try using the HTTPS remote for your project rather than the SSH one and tell me how it goes.

This can be done by:

1.Visiting your project URL on GitLab e.g. https://gitlab.com/USERNAME/PROJECTNAME
2. Get the project’s HTTPS remote url by clicking on the git REMOTE url dropdown and selecting HTTPS e.g.


3. Go to your shell and change the REMOTE URL by using the following command

  • git remote set-url origin COPIED_HTTPS_URL
  1. Then try to push

Thanks for your great help