3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

httpでgitで記号混ざりのidとpassを1行指定してclone

Posted at

いろいろ残念な理由でhttpでgit cloneなどしなければいけない & privateで、ユーザー名とパスワードを指定する必要がある場合

git clone http://<id>:<pass>@git.httpserver.com/private/repository.git

とやればいいが、パスワードにスラッシュとか使っちゃった場合など、パースが上手にできないみたいでエラーになる。おそらく記号はダメだろう。

こういう場合にはpercent encodeしてあげればいいらしい。
たとえば私のIDが p.kato@email.com 、パスワードが pass/word だった場合以下のようでよいようだ。

git clone http://p.kato%40email.com:pass%2Fword@git.httpserver.com/private/repository.git

これは

$ git --version
git version 1.9.1

という環境で試した。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?