How do I create a folder in a GitHub repository?

后端 未结 12 1177
庸人自扰
庸人自扰 2020-12-02 03:40

I want to create a folder in a GitHub repository and want to add files in that folder. How do I achieve this?

12条回答
  •  甜味超标
    2020-12-02 04:16

    You cannot create an empty folder and then add files to that folder, but rather creation of a folder must happen together with adding of at least a single file. On GitHub you can do it this way:

    • Go to the folder inside which you want to create another folder
    • Click on New file
    • On the text field for the file name, first write the folder name you want to create
    • Then type /. This creates a folder
    • You can add more folders similarly
    • Finally, give the new file a name (for example, .gitkeep which is conventionally used to make Git track otherwise empty folders; it is not a Git feature though)
    • Finally, click Commit new file.

提交回复
热议问题