我想通过添加用户名和密码来克隆 git 存储库以进行身份验证,如下所示:
https://myUserName:myPassWord@myGitRepositoryAddress/myAuthentificationName/myRepository.git
但是我的密码包含 @
(如 123@asd
),这会导致 git 存储库 url 出现问题,并且出现如下错误:
https://123@myGitRepositoryAddress/myAuthentificationName/myRepository.git
和第一个@
视为分隔符。
最佳答案
为了在 URL 中使用 @
符号,您必须使用 percent-encoding 。 @
的百分比代码是 %40
。因此,如果您想使用用户名 user
和密码 123@asd
克隆存储库,则必须使用以下网址:
https://user:123%40asd@myGitRepositoryAddress/myAuthentificationName/myRepository.git
关于git - 将用户名和密码添加到 git clone url 时,密码中的 at 符号会出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60826661/