How to troubleshoot a url error with “Port number ended with 'y'”?

前端 未结 5 2050
失恋的感觉
失恋的感觉 2021-02-08 15:54

While trying to clone an already existing repository from gitlab into my local drive. I used the format

$ git clone https://github.com/libgit2/libgit2  mylibgit          


        
相关标签:
5条回答
  • 2021-02-08 16:35

    Gitlab actually requires a user when using deploy tokens. For me, this was caused by mixing in ssh syntax as http://<user>:<pass>@gitlab.com:repo instead of gitlab.com/repo.

    0 讨论(0)
  • 2021-02-08 16:35

    if you change your remote from using ssh to https and accidentally leave a colon in the string - you will a message like this. It's a confusing message, but it makes sense once you understand the source of the problem.

    0 讨论(0)
  • 2021-02-08 16:38

    For gitlab, you don't need to specify the user.
    Replace it by an https url based on your GitLab account name.

    cd /path/to/your/repo
    git remote set-url origin https://gitlab.com/<username>/<yourProjectName.git>
    git push -u origin master
    

    Note:

    trying to clone an already existing repository from gitla

    This contradict "git clone https://github.com/libgit2/libgit2", since this is a GitHub url, not a GitLab one.

    0 讨论(0)
  • 2021-02-08 16:57

    I had similar problem. Just corrected(removed git@ and port number) URL in .git/config file and it worked.

    [remote "origin"] url = https://git@gitlab.com:xxxxx/yyyyyy/

    To

    [remote "origin"] url = https://gitlab.com/yyyyyy/

    0 讨论(0)
  • 2021-02-08 17:00

    I later found the problem, I was not typing cd /path/to/your/repo at the beginning.

    I was actually typing gitlab instead of Github.

    Thanks.

    0 讨论(0)
提交回复
热议问题