1

I have a password that has ! in it and when am trying to clone a repository from git using the following syntax:

  git clone https://username:password!@github.com/org/repository.git

I am getting this error:

 bash: !@github.com/org/repository.git: event not found

How can I fix it without changing password?

I am in Linux. I have used this in windows without any problem.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
mans
  • 17,104
  • 45
  • 172
  • 321

1 Answers1

11

Just backslash the exclamation mark. It has a special meaning in bash (history expansion).

git clone https://username:password\!@github.com/org/repository.git

You can also wrap it into single quotes ('):

git clone 'https://username:password!@github.com/org/repository.git'
Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
choroba
  • 231,213
  • 25
  • 204
  • 289