Initialize a Git repository trouble?


#1

When I enter the command “git add README.txt”, this message appears, “fatal: not a git repository (or any of the parent directories): .git”. I am confused because I made the file already using the echo command, “echo “Hello Git and GitHub” >> README.txt”. Been stuck on this for days now. Can anyone help me with this?

Link:
https://www.codecademy.com/paths/computer-science/tracks/cspath-development-skills/modules/learn-git-git-workflow-u/articles/f1-u3-git-setup


#2

the problem isn’t that the README.txt doesn’t exist, the problem is that commands (git add) can only be done if a git repository is initialized, which judging by the error isn’t the case

initializing a git repository (git init) creates a .git directory, could be a glitch in the lesson? You could initialize the repository again?


#3

Thanks for replying. I just initialized it again and added it to the staging area, and got this message, “warning: LF will be replaced by CRLF in README.txt.
The file will have its original line endings in your working directory” am I all set to commit now?


#4

funny enough, i recently got this error message in one of my own projects, haven’t gotten to the bottom of it, seems to have to do with line/file ending, you can ignore it for now and commit


#5

Set git’s core.autocrlf to true on windows to convert when checking in/out.