gitgit-init

Setting up Git via Terminal on macOS High Sierra


I am learning Git via the Pro Git book.
To begin setup it tells to open Terminal and execute git init on the project I want to start revisioning.

Problem is: this command successfully creates a .git hidden folder only if I execute it in my home directory (\Users\<username>).

If I drag the needed folder into Terminal and write git init I get the error: is a directory.
What does that mean?
I have read plenty of guides and no one seems to help me.

How do I setup Git via Terminal in a successful way? The linked questions' instructions didn't help.


Solution

  • git init create a project in that folder you're in. So create a new folder first and change in that folder.

    mkdir test
    cd test
    git init
    

    You can find it in the documentation in the last example:

    https://git-scm.com/docs/git-init