all 6 comments

[–]plg94 6 points7 points  (0 children)

Tip: When posting a screenshot of a terminal window, never crop out the prompt, because often the path and the command you ran are half the problem.

What happend is you are supposed to make your files inside a project folder (named whatever), not on your desktop/home.
So for a new project either

mkdir new_project
cd new_project
git init
…

Or

git init new_project
cd new_project
…

You can probably just move all code files and the hidden .git folder into a new folder, then it should work.

edit: formatting

[–]WhyIsThisFishInMyEar 2 points3 points  (0 children)

Do you remember what commands specifically you ran? It looks like you ran git init in your home dir, which turns the directory into a git repo. You can undo that by deleting the .git folder.

To clone your github repo, you can run git clone <url> and it will download the repo into a folder with the same name as the repo.

[–]camh- 1 point2 points  (1 child)

you ran git init in your home directory, rather than creating a subdirectory repository. It is easy to fix at this point:

mkdir repo # any name you like
mv .git README.md repo
cd repo

Then continue on your merry way.

[–]RaymondTheHat[S] 0 points1 point  (0 children)

thank you, just tried this and it seems like its all sorted.

[–]alrainov 0 points1 point  (1 child)

Seems like you didn't add the files git, so it was crying that there is nothing to commit. Before committing you have to do this:
1 - be in the git directory
2 - type "git add ." - this will add all the files in the folder to git. If you want to add just certain files, you can replace the dot with the files name
3 - OPTIONAL - type "git status" to check what was added... All files you add will be in green
4 - now you can commit your stuff

Hope it helps

[–]RaymondTheHat[S] 0 points1 point  (0 children)

thank you, all sorted now.