Here is a simple tutorial on how to solve error: “syntax error near unexpected token `newline'”
Symptom
The message syntax error near unexpected token `newline’ is displayed after the git add command is executed.
Analysis
The command contains a diamond operator (<>).
Solution
Delete the diamond operator (<>) in the command, for example, $ git add README.md.