Git can't add file

I have this file: Default (OSX).sublime-keymap and when I try git add Default (OSX).sublime-keymap I get the following error: sh: syntax error near unexpected token('` is there a workaround...or I need to rename the file...

Answers


There are two related problems with your use of the command line, neither of which is specific to Git:

  • Parentheses need to be escaped. Your command line shell is actually an interpreter, and parentheses are significant to it.
  • Spaces need to be escaped. Spaces separate commands and arguments. Assuming you've escape the parentheses, you're now passing two files to git add, one called "Default" and one called "(OSX).sublime-keymap".

You need to either use quotes around the whole filename, or escape the parentheses and spaces with backslashes:

git add "Default (OSX).sublime-keymap"

or

git add Default\ \(OSX\).submlime-keymap

Note that your shell may support tab-completion. Try typing git add Def and hitting tab a few times, and your shell may auto-complete the filename for you, correctly escaping the spaces and parentheses.


Need Your Help

Fast java byte manipulation

java io embedded bytearray bytebuffer

I am trying to develop a Java application that will run on an embedded device. Since it is an embedded device it may be fairly slow. Speed is an important factor. After doing a little research on

show data into jtable a bit different way

java swing file jtable

I have a code that read file and store in arraylist and then convert to array(To use for table model)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.