git - 将用户名和密码添加到 git clone url 时,密码中的 at 符号会出现问题

标签 git command-line

我想通过添加用户名和密码来克隆 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/

相关文章:

git - 在git中将文件批量重命名为小写

java - ./gradlew assemble 在文件明显存在时由于缺少文件而失败

python - pip install -U 中的 "-U"选项代表什么

java - Gradle并行执行命令行

Git代理失败需要帮助

git - 推送到 github 的文件夹不包含任何内容

linux - "vino-preferences"在哪里存储其配置属性

Postgresql更新基于计数、最小值和分组依据

git - BitBucket 不接受我的 SSH key ?

python - 在 Visual Studio Code 中将文件添加到 gitignore