簡體   English   中英

如何在git URL中轉義密碼的“ @”

[英]How can I escape `@` of password in git URL

借口:
我看到了這一點: git代理密碼中的Escape @字符但這是關於http.proxy參數的,而p%4055url參數方面對我不起作用。

我的問題:
我使用git版本1.7.1
我的密碼存儲庫是: p@55
我使用gitlab服務器,並使用centos作為客戶端。
.git/config文件中,我是這樣的:

[remote "origin"]
url = http://user:p@55@domain.com:port/repo.git

但是當我拉它時,給了我這個錯誤:

error: Couldn't resolve host '55:domain.com' while accessing ...

我知道轉義@ char,但是:

我嘗試p\\@55 ,給我這個錯誤:

fatal: bad config file line 8 in .git/config

我嘗試p%4055 ,給我這個錯誤:

error: The requested URL returned error: 401 while accessing ...

我只是將git版本從1.7.1升級到2.11.1,這對我有用:

url = http://user:p%4055@domain.com:port/repo.git

嘗試使用@-(%40)符號的URL編碼值。

您的例子:

網址= http:// user:p%4055@domain.com:port / repo.git

編輯:

如果上述方法不起作用,請使用以下方法:

sshpass -p密碼git克隆ssh://username@onboard.com/srv/git/repo

暫無
暫無

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

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