How do I create a folder in a GitHub repository?

后端 未结 12 1111
庸人自扰
庸人自扰 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 03:50

    Create a new file, and then on the filename use slash. For example

    Java/Helloworld.txt

    0 讨论(0)
  • 2020-12-02 03:50

    Here is an easy and quick, presently available browser approach to creating folders inside a repository

    1)Click the repository / create a new repository.

    2)Click create Add file and then create a new file.

    3)Give the folder name you want to create with a ' / ' mark and then add a file in it

    4)Commit the changes

    Click here for the visual representation of the above steps in order.

    0 讨论(0)
  • 2020-12-02 04:02

    You just create the required folders in your local repository. For example, you created the app and config directories.

    You may create new files under these folders.

    For Git rules:

    1. First we need to add files to the directory.
    2. Then commit those added files.

    Git command to do commit:

    1. git add app/ config/
    2. git commit

    Then give the commit message and save the commit.

    Then push to your remote repository,

    git push origin remote
    
    0 讨论(0)
  • 2020-12-02 04:06

    Git doesn't store empty folders. Just make sure there's a file in the folder like doc/foo.txt and run git add doc or git add doc/foo.txt, and the folder will be added to your local repository once you've committed (and appear on GitHub once you've pushed it).

    0 讨论(0)
  • 2020-12-02 04:09

    Actually GitHub does not create an empty folder.

    For example, to create a folder in C:\Users\Username\Documents\GitHub\Repository:

    • Create a folder named docs

    • Create a file name index.html under docs

    • Open the GitHub for desktop application

      It will automatically sync, and it will be there.

    0 讨论(0)
  • 2020-12-02 04:10

    To add a new directory all you have to do is create a new folder in your local repository. Create a new folder, and add a file in it.

    Now go to your terminal and add it like you add the normal files in Git. Push them into the repository, and check the status to make sure you have created a directory.

    0 讨论(0)
提交回复
热议问题