Git clone with password @

六眼飞鱼酱① 提交于 2019-12-19 06:06:22

问题


I need to escape the @ that use the password because it is confused with the host.

Example 1: git clone https://user:p@ssword@github.com/user/repo.git

When I run the above example, it's wrong, because as the password has @ he understands that the next parameter is the host. tried to escape with \ or you can use the url between "" but it was not.

Example 2: (echo user; echo p@ssword) | git clone https://github.com/usuario/repo.git

When I use only the command,git clone https://github.com/usuario/repo.git he asks the User and Password, so I used the above command, which is the same that I use to change the root password on a line only.


回答1:


I think what you are looking is to escape the special character @, which you can use encode %40 instead of @. This link might help Escape @ character in git proxy password




回答2:


You can replace @ with its URL encoded format %40

if your password is password@99. Change it to password%4099

git clone https://username:password%4099@bitbucket.org/sarat.git



回答3:


Check the link Git Configure

Configure your git account in local -

git config --global user.name myName

git config --global user.email myEmail

The following command will save your password in memory for sometime.

$ git config --global credential.helper cache

Set git to use the credential memory cache

$ git config --global credential.helper 'cache --timeout=3600'

Set the cache to timeout after 1 hour (setting is in seconds)

Hope this would help you



来源:https://stackoverflow.com/questions/27161081/git-clone-with-password

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!