Would a carriage return ^M in SSH key make a difference?

I cloned a git repo to a server that had same files scattered in different places. Then I compared two directories (cloned one to existing one) to make sure that they were exactly the same. The comp command showed that there is only one difference and that is in an ssh key on the remote server files. There is carriage return ^M present in the remote file. Would that change the key? If yes, how can I remove the carriage return in vim.

Asked By: Cruise5


No carriage returns are allowed so use substitution to remove them:


Don’t just copy the above; to insert the control character ^M you have to press Ctrl+V and then Ctrl+M (otherwise if you copy-paste you will just insert the two characters ^M and you will get Pattern not found).

If the whole file instead was recognized as dos type, the following would also work:

:wq ++ff=unix

(change fileformat to unix, save and quit).

Answered By: AndroidX
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.