我想在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.

其他回答

点击新文件在github回购在线。 然后写文件名为myfolder/myfilename,然后给出文件内容并提交。然后文件将在该新文件夹中创建。

简单的步骤:

步骤1:单击创建新文件


第二步:输入你想要的文件夹名称,然后按/


步骤3:输入一个示例文件名。您必须输入一些文本。


步骤4:单击Commit new file创建文件夹


步骤5:创建文件夹!

只需将文件夹从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.

在文件名字段中使用/来创建文件夹,例如在文件名字段中输入folder1/file1将创建文件夹folder1和文件file1。

原来的答案 您不能创建一个空文件夹,然后将文件添加到该文件夹,而是创建一个文件夹必须同时添加至少一个文件。这是因为git不跟踪空文件夹。

在GitHub上,你可以这样做:

转到要在其中创建另一个文件夹的文件夹 点击新建文件 在文件名的文本字段中,首先写上要创建的文件夹名 然后输入/。这会创建一个文件夹 您可以类似地添加更多文件夹 最后,为新文件命名(例如,.gitkeep,通常用于让Git跟踪空文件夹;但它不是Git的特性) 最后,单击提交新文件。