Git version control with local files

Ok, I have a project in a folder with a name mywebsitethat is in my documents folder on my mac. How to use git to version control this folder?

Every time I try to do something, I get some kind of fatal error, and it really annoys me now, can you help?

I do git init, then mkdir, and then I tried to add and clone the files to no avail.

git init 
git mkdir mywebsite 
cd mywebsite 
git clone file://localhost/Users/me/Documens/sites/mywebsite 
fatal '/Users/me/Documens/sites/mywebsite' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly

Please, help!

+3
source share
1 answer

If you already have files in ' mywebsite':

cd /Users/me/Documens/sites/mywebsite
git init . # note the final '.'

then do a git statusto see what needs to be added.

git add .
git status # check what has been added
git commit -m "first commit" 

If you do not already have a file, you can:

cd /Users/me/Documens/sites/
git init mywebsite
cd mywebsite # you are now in an empty git repo
+4

Source: https://habr.com/ru/post/1763753/


All Articles