git Bitbucket 克隆:端口号以“T”结尾
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47076616/
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
Bitbucket clone: Port number ended with 'T'
提问by DenCowboy
I try to make a clone (mirror) of my bitbucket repo using jenkins execute shell (not the git plugin).
我尝试使用 jenkins execute shell(不是 git 插件)制作我的 bitbucket 存储库的克隆(镜像)。
My credentials:
我的凭据:
username
passwd
are saved in a variable: myuser
The credentials are right. We used this pluginto save the credentials. We're doing exactly the same for some other repo's (on our local git, not bitbucket) and it's working very good.
保存在一个变量中:myuser
凭据是正确的。我们使用这个插件来保存凭据。我们对其他一些存储库(在我们的本地 git 上,而不是 bitbucket 上)所做的完全相同,并且运行良好。
Now I try:
现在我尝试:
git clone --mirror https://${myuser}@bitbucket.org/team/repo.git
The error I'm facing is:
我面临的错误是:
fatal: unable to access 'https://****@bitbucket.org/team/repo.git/': Port number ended with 'T'
回答by pshchelo
Was just banging by head around with a similar problem (attempt to clone from Gerrit over HTTPS with random HTTP password generated by Gerrit UI, URL in the form of https://<username>:<password>@<gerrit.repo.url>
and getting 'Port Number ended with...' error), and it appears that the password must be properly url-quoted.
只是遇到了类似的问题(尝试使用由 Gerrit UI 生成的随机 HTTP 密码通过 HTTPS 从 Gerrit 克隆,URL 的形式为https://<username>:<password>@<gerrit.repo.url>
“端口号以...结尾”错误),看来密码必须正确引用 url。
Realized that after trying to set git-credentials with 'store' helper and peeking at the file it created :-)
意识到在尝试使用“store”助手设置 git-credentials 并查看它创建的文件后:-)
回答by Nasir Ahmad
We need to encode the URL while passing special characters in the usernames or passwords with http or https protocol. For example if you want to use user#1in password and want to use it in URL you need to encode the #using %23and the password becomes user%231.
我们需要对 URL 进行编码,同时使用 http 或 https 协议在用户名或密码中传递特殊字符。例如,如果您想在密码中使用user#1并想在 URL 中使用它,您需要使用%23对#进行编码,密码变为user%231。
Reference: https://github.com/curl/curl/issues/1909#issuecomment-331565533
参考:https: //github.com/curl/curl/issues/1909#issuecomment-331565533
回答by xxx374562
For me also git clone was not working. But after adding proper git remote origin it worked.
对我来说 git clone 也不起作用。但是在添加了适当的 git remote origin 后,它起作用了。
Step 1. mkdir /local/repo/dir && cd /local/repo/dir
Step 2. git init
Step 3. git remote add origin https://<username>@bitbucket.org/<orgName>/<reponame>.git
Now git pull works without any issue
现在 git pull 可以正常工作了