如何 git 从 docker requirements.txt 克隆
How to git clone from a docker requirements.txt
我正在尝试在 docker 环境中设置我的应用程序。我设置了一个 requirements.txt 文件,其中包含存储库的位置以及我的用户名和密码。当我所有的密码都是数字时,它以前工作得很好。但我最近更改了我的密码,现在它包含 #
个字符。现在它不会读取我的密码。下面是其中的一个例子
git+https://myusername:my#password@bitbucket.org/repository/repository.git#egg=MY_PROJECT
现在 returns 一个错误
fatal: unable to access 'https://myusername:my/': Could not resolve host: myusername
我猜这是因为 my
密码后的 #
字符。我尝试在 #
字符之前放置一个 \
但仍然没有成功。有什么解决方法吗?
你必须%-encode个特殊字符:
>>> import urllib
>>> urllib.quote('#')
'%23'
所以你的URL必须是
git+https://myusername:my%23password@bitbucket.org/repository/repository.git#egg=MY_PROJECT
我正在尝试在 docker 环境中设置我的应用程序。我设置了一个 requirements.txt 文件,其中包含存储库的位置以及我的用户名和密码。当我所有的密码都是数字时,它以前工作得很好。但我最近更改了我的密码,现在它包含 #
个字符。现在它不会读取我的密码。下面是其中的一个例子
git+https://myusername:my#password@bitbucket.org/repository/repository.git#egg=MY_PROJECT
现在 returns 一个错误
fatal: unable to access 'https://myusername:my/': Could not resolve host: myusername
我猜这是因为 my
密码后的 #
字符。我尝试在 #
字符之前放置一个 \
但仍然没有成功。有什么解决方法吗?
你必须%-encode个特殊字符:
>>> import urllib
>>> urllib.quote('#')
'%23'
所以你的URL必须是
git+https://myusername:my%23password@bitbucket.org/repository/repository.git#egg=MY_PROJECT