How to troubleshoot a url error with "Port number ended with 'y'"?
Asked Answered
M

6

13

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 

The resulting folder e.g mylibgit was found somewhere outside the XAMPP web folder (i.e htdocs), I moved it there but it's not working as supposed.

I moved it out to my desktop and got the error :

fatal: unable to access 'https://[email protected]:xxxxx/yyyyyy/':Port number ended with 'y'
Mel answered 29/7, 2017 at 5:33 Comment(3)
You're mixing SSH urls with https.Sisto
Maybe this article help: https://mcmap.net/q/45383/-how-do-i-provide-a-username-and-password-when-running-quot-git-clone-email-160-protected-quotMccutcheon
use git clone [email protected]:libgit2/libgit2.gitMichelle
C
11

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.

Competent answered 29/7, 2017 at 7:10 Comment(7)
@Madeo What does git remote -v return? You would see 'origin' if you have cloned a repository. But for a new local repository, you would need to add a remote.Competent
@Madeo cd /path/to/local/new/repo; git remote add oprigin https://gitlab.com/<aproject>/<arepo>: make sure <aproject>/<arepo> on GitLab is anew empty repository (no README, no nothing)Competent
@Madeo I would need to see the URL used to understand. There is no port number involved.Competent
@Madeo git remote add works perfectly in an initialized repo, with HTTPS or SSH URLs. You simply used an incorrect URL triggering that "Port number" error message.Competent
@Madeo I did not express an opinion when stating "git remote add works perfectly in an initialized repo, with HTTPS or SSH URLs. I was stating a fact, a practice seen many times over the years, including in official documentations: help.github.com/en/github/importing-your-projects-to-github/…Competent
@Madeo So I would be genuinely interested to know what URL did you use which could possibly trigger Port number ended with 'c'Competent
Let us continue this discussion in chat.Competent
O
4

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.

Ocasio answered 18/2, 2019 at 23:7 Comment(0)
V
2

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.

Vander answered 28/8, 2020 at 18:48 Comment(0)
R
1

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

[remote "origin"] url = https://[email protected]:xxxxx/yyyyyy/

To

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

Reardon answered 17/2, 2020 at 9:58 Comment(0)
M
0

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.

Mel answered 29/7, 2017 at 19:59 Comment(1)
As a new user, my votes don't count, yet. So, "thanks" is still the word.Mel
T
0

This may be useful for someone, in my case I just had a wrong URL with : instead of @ before the Gitlab URL:

https://user:token:gitlab.com/repo.git

should be

https://user:[email protected]/repo.git

I know it's obvious but it's just worth double-checking the format :D

Theravada answered 29/11, 2023 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.