“git add” returning “fatal: outside repository” error

前端 未结 10 2021
情话喂你
情话喂你 2021-01-31 16:34

I\'m just entering into the wonderful world of git. I have to submit a bunch of changes that I\'ve made on my program, located in a directory called /var/www/myapp

10条回答
  •  醉酒成梦
    2021-01-31 17:01

    Git only tracks files and folders within the root folder which includes the .git directory and the subfolders inside root folder. The folder you are trying to add is outside the scope of git.

    What would you actually like to do is first git checkout -b myapp which will create and checkout a new branch based on the master branch of the repository you cloned. Then you would actually copy all your files over and commit them with git commit -a -m "Short descriptive name about what you did". The parameter -a you passed to git commit is for including all the changes done to the repository and -m is to include the commit message in the actual command. After that you can either push back to the main repository if you have write access to it or push it to your own public repo or don't push it at all.

    What I've described above is pretty much the basics of git. Try reading this book which is pretty descriptive.

提交回复
热议问题