簡體   English   中英

使用密碼@的Git克隆

[英]Git clone with password @

我需要逃避使用密碼的@,因為它與主機混淆。

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

當我運行上面的例子時,這是錯誤的,因為密碼有@他知道下一個參數是主機。 試圖用\\逃脫,或者你可以使用“”之間的網址,但事實並非如此。

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

當我只使用命令時, git clone https://github.com/usuario/repo.git他詢問用戶和密碼,所以我使用了上面的命令,這與我用來更改root密碼的命令相同只行。

我認為你正在尋找的是逃避特殊字符@,你可以使用編碼%40而不是@。 此鏈接可能有助於在git代理密碼中使用Escape @ character

您可以使用其URL編碼格式%40替換@

如果您的密碼是密碼@ 99 將其更改為密碼%4099

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

檢查鏈接Git Configure

在本地配置您的git帳戶 -

git config --global user.name myName

git config --global user.email myEmail

以下命令將密碼保存在內存中一段時間​​。

$ git config --global credential.helper cache

設置git以使用憑證內存緩存

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

1小時后將緩存設置為超時(設置以秒為單位)

希望這會對你有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM