我想在GitHub存储库中创建一个文件夹,并想在该文件夹中添加文件。我该如何做到这一点?


当前回答

创建一个新文件,然后在文件名上使用斜杠。例如

Java / Helloworld.txt

其他回答

Git不存储空文件夹。只要确保文件夹中有一个文件,比如doc/foo.txt,然后运行git add doc或git add doc/foo.txt,一旦你提交了,这个文件夹就会被添加到你的本地存储库中(一旦你推送它,它就会出现在GitHub上)。

创建一个新文件,然后在文件名上使用斜杠。例如

Java / Helloworld.txt

要添加新目录,您只需在本地存储库中创建一个新文件夹。创建一个新文件夹,并在其中添加一个文件。

现在转到终端,像在Git中添加普通文件一样添加它。将它们放入存储库,并检查状态以确保创建了一个目录。

只需将文件夹从Windows资源管理器拖到浏览器的github上传文件显示-现在文件夹将自动添加…

对于使用浏览器的用户,可以执行以下操作:

Once in the master repository, click on Create new file. In the name of file box at the top, enter the name of your folder Use the / key after the name of the folder. Using this forward slash creates the folder You can see a new box appear next to the folder name wherein you can type the name of your file. In the Commit new file box at the bottom of the page, you can type the description for your file. Select the radio button Commit directly to the master branch. Click on the Commit new file button You will see the new directory will be created.