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
  • 61,565
  • 12
  • 180
  • 225
mans
  • 15,766
  • 39
  • 153
  • 296

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
  • 19,240
  • 7
  • 48
  • 73
choroba
  • 216,930
  • 22
  • 195
  • 267