使用带有用户名和密码的 http 进行 Git 克隆
我尝试使用 git clone http://user:[email protected] 但我在添加用户或密码时遇到一些问题,因为用户使用的电子邮件包含其他 @并且密码使用感叹号 (!),
该命令类似于 http://[电子邮件受保护]:[email protected]/git
这不起作用 - 我尝试了 0x21password 而不是 !password 但系统不排除这个。
有什么想法吗?
I try to use git clone http://user:[email protected] but I have some problems with adding user or password because the user is using email which contains an other @ and password is using an esclamation mark ( ! )
the command looks like http://[email protected]:[email protected]/git
This is not working - I tried 0x21password instead of !password but the system don't except this.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个很老的问题,但让我添加解决方法以造福他人。我们最近开始使用电子邮件 ID 作为用户名来连接到 Git,但 pull/fetch/push 等命令开始失败。我们按照之前评论中的建议尝试了 %40,但没有成功。因此,我们创建了包含以下信息的 ~/.netrc 文件。
机器 git.myserver.com
登录 [电子邮件受保护]
密码 mypassword
我们还从存储在 .git/config 文件中的 url 中删除了用户名。我们现在可以进行拉取/提交等操作。不建议使用这种方法,因为密码以纯文本形式存储在文件中,但这是一种快速解决方法,可以在寻找使用命令行工具中的电子邮件 ID 进行连接的方法时进行紧急提交。
This is pretty old question but let me add the workaround for benefits of others. We recently started using email id as username to connect to Git, but pull/fetch/push etc commands started failing. We tried %40 as suggested in previous comments but it didnt work. So we created ~/.netrc file with following information.
machine git.myserver.com
login [email protected]
password mypassword
We also removed username from the url which gets stored in .git/config file. And we could now do pull/commit etc. Its not advisable to use this approach because password is stored in plain text in a file but that was a quick workaround to make urgent commit while looking for ways to connect using email id from command line tool.
您是否尝试过 http://user%40home.com:[电子邮件受保护]/git
have you tried http://user%40home.com:[email protected]/git