Correct Git clone syntax for SSH-Collection of common programming errors

The problem for me was write access to the directory and I fixed it using “sudo”. I had to create an alias in my bash profile that shorthanded the sudo command before the git command.

Below is the line I added to my .profile file and it works great. I no longer have the “fatal: could not create work tree dir…” message anymore.

alias sgit="sudo /usr/local/git/bin/git"

UPDATE

I spoke too soon. Doing this caused other issues with programs on my Mac to save files in the directory since the directory was owned by root. I had to change the root directory to my user account (which is also admin). This in turn made my alias to “sudo git” useless since I can now just use git without sudo. Hope this helps someone.