git 如何将文件夹中的所有内容添加到我的 GitHub 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38689570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Add ALL of the contents in a folder to my GitHub Repo
提问by abtecas
I am new to git and github in particular. I am using gitbash, and I would like to upload EVERYTHING in my project folder to the repo on github.
我是 git 和 github 的新手,尤其是。我正在使用 gitbash,我想将项目文件夹中的所有内容上传到 github 上的存储库。
I intially did it with the web based GUI, but for some reason it strips ALL of my files from their folder and places them all in one directory, which is weird because when I did this with a different project it went fine with all the directory structure intact.
我最初是使用基于 Web 的 GUI 完成的,但出于某种原因,它从文件夹中删除了我的所有文件并将它们全部放在一个目录中,这很奇怪,因为当我使用不同的项目执行此操作时,所有目录都运行良好结构完好。
Now for using gitbash, I first did a git init on my directory where the project lives, then did all of the config steps to get to my remote repo. When I do a git add, and then git status, it doesnt list any files (but ls does show all of my files and folders). When I create a new test file and then do git add ., then git status - it shows the new test file.
现在为了使用 gitbash,我首先在项目所在的目录上执行了 git init,然后执行了所有配置步骤以访问我的远程存储库。当我执行 git add 和 git status 时,它没有列出任何文件(但 ls 确实显示了我的所有文件和文件夹)。当我创建一个新的测试文件,然后执行 git add .,然后 git status - 它显示新的测试文件。
I am totally confused after an entire day of youtube and SO, I cannot push a project to the remote repo via gitbash, and cannot seem to do so in the GUI WITHOUT all of my files being stripped from their directory and put in one single directory.
经过一整天的 youtube 和 SO,我完全困惑,我无法通过 gitbash 将项目推送到远程存储库,并且似乎无法在 GUI 中执行此操作,而不会将我的所有文件从其目录中剥离并放入一个目录中.
回答by Charlie Fish
Using the following command inside the git repo will add all the files.
在 git repo 中使用以下命令将添加所有文件。
git add .
git add .
After running that command you can commit normally. For example.
运行该命令后,您可以正常提交。例如。
git commit -m "COMMIT MESSAGE HERE"
git commit -m "COMMIT MESSAGE HERE"
回答by elesos
Using the following command inside the git repo will add all the files.
git add -A
在 git repo 中使用以下命令将添加所有文件。
git add -A