"git add" returning "fatal: outside repository" error

First in the clone folder you can create a Branch (so the master stay untouched)

git branch [branch_name]

After, just copy the files you want from your old folder to the clone folder.

When you are done, just add / commit your change and Merge your branch into the "master" branch. It will look like to something like this:

git add .
git commit -m "Comments"
git checkout master
git merge [new_branch]

Try this tutorial from GitHub.


To add some files or folder to your repository, they have to be in the folder you created with git clone. So copy/paste your application in your local git folder and then go in it and do git add * and then you'll be able to commit to the server with git commit -m 'message' and finally push the changes to the server with git push


You'll have to move all the files from /var/www/myapp to /home/mylogin/gitclone and then do a git add . and then git commit -m "Your message".


When upgraded to git version 2.12.2 that error appeared, I nooted the i add the file with a full path like:

git add c:\develop\project\file.text

when removed the full path it start working, like:

git add file.text