【问题标题】:How to git clone from a docker requirements.txt如何从 docker requirements.txt git clone
【发布时间】:2017-12-27 06:54:47
【问题描述】:

我正在尝试在 docker 环境中设置我的应用程序。我已经设置了一个 requirements.txt 文件,其中包含存储库的位置以及我的用户名和密码。当我所有的密码都是数字时,它以前工作得很好。但是我最近更改了密码,现在它包含# 字符。现在它不会读取我的密码。下面是一个示例

git+https://myusername:my#password@bitbucket.org/repository/repository.git#egg=MY_PROJECT

现在它返回一个错误

fatal: unable to access 'https://myusername:my/': Could not resolve host: myusername 

我猜这是因为# 密码后面的my 字符。我尝试在# 字符之前放置一个\,但仍然没有运气。有什么解决方法吗?

【问题讨论】:

    标签: python git requirements.txt


    【解决方案1】:

    你必须%-encode特殊字符:

    >>> import urllib
    >>> urllib.quote('#')
    '%23'
    

    所以你的网址必须是

    git+https://myusername:my%23password@bitbucket.org/repository/repository.git#egg=MY_PROJECT
    

    【讨论】:

    • 这修复了它。非常感谢
    猜你喜欢
    • 2015-08-05
    • 2019-02-03
    • 1970-01-01
    • 1970-01-01
    • 2016-09-03
    • 2011-02-17
    • 1970-01-01
    • 1970-01-01
    • 2011-09-03
    相关资源
    最近更新 更多