Search code examples
giturigit-clone

git clone command for uri with special chars


im trying to execute git clone command in one line :

git clone https://user%40mail.com:seckey@https://hostname.com/_git/project%20name

i got an error : Could not resolve host: https

when i execute :

git clone https://hostname.com/_git/project%20name

and enter the user name and pass manually everything is working but when i do it in one line i get an error

i guess the problem with the URL or with the %20 in the URI coz the project name have space in it . tried adding "" or '' didnt help any ideas ?

thanks !


Solution

  • You have https:// twice in your clone URL. Remove https:// after the @ sign:

    git clone https://user%40mail.com:[email protected]/_git/project%20name