In step 1, I added a string to some text file. In step 2 I typed git init at a bash prompt and it created a project directory under sorcerers code. Where and how did it know where to create it? (sorcerers-code) Was there some information I wasn’t aware of in Step 1 that told me where the .txt file was?
If you run the command directly it will try to create a repository in the current working directory which is, or should be, the /home/ccuser/workspace/sorcerers-code directory (you can check working directory with pwd). So roughly equivalent to git init . (the . links to current dir); you could use a path as an argument if you want to e.g. git init ~/path/to/project.
The repo will offer to track items within this directory recursively, one of which is the relevant .txt file.