git 如何解决“端口号以‘y’结尾”的网址错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45385673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to troubleshoot an url error with "Port number ended with 'y'"?
提问by Seunara
While trying to clone an already existing repository from gitlab into my local drive. I used the format
在尝试将 gitlab 中现有的存储库克隆到我的本地驱动器时。我用的格式
$ 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.
结果文件夹例如mylibgit
在 XAMPP web 文件夹(即 htdocs)之外的某个地方找到,我将它移到那里,但它没有按预期工作。
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'
回答by VonC
For gitlab, you don't need to specify the user.
Replace it by an https url based on your GitLab account name.
对于 gitlab,您不需要指定用户。
根据您的 GitLab 帐户名将其替换为 https url。
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
试图从 gitla 克隆一个已经存在的存储库
This contradict "git clone https://github.com/libgit2/libgit2
", since this is a GitHub url, not a GitLab one.
这与“ git clone https://github.com/libgit2/libgit2
”相矛盾,因为这是一个 GitHub 网址,而不是 GitLab 网址。
回答by thisismydesign
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
.
Gitlab 在使用部署令牌时实际上需要一个用户。对我来说,这是由于混合了 ssh 语法http://<user>:<pass>@gitlab.com:repo
而不是gitlab.com/repo
.
回答by Narendra Kothule
I had similar problem. Just corrected(removed git@ and port number) URL in .git/config file and it worked.
我有类似的问题。刚刚在 .git/config 文件中更正(删除了 git@ 和端口号)URL 并且它起作用了。
[remote "origin"] url = https://[email protected]:xxxxx/yyyyyy/
[远程“起源”] url = https://[email protected] :xxxxx/yyyyyy/
To
到
[remote "origin"] url = https://gitlab.com/yyyyyy/
[远程“起源”] url = https://gitlab.com/yyyyyy/
回答by Seunara
I later found the problem, I was not typing cd /path/to/your/repo
at the beginning.
后来发现问题,一开始没打字 cd /path/to/your/repo
。
I was actually typing gitlab
instead of Github
.
我实际上是在打字gitlab
而不是Github
.
Thanks.
谢谢。