How To Create A Folder In A Repository In Github
Github is an incredible tool for storing, sharing, and learning code. Creating code repositories is a cinch but common methods of organization, like how to create a folder in Github, aren't intuitive.
- 1 Overview
- 2 Step 1: Have a Repository
- 3 Step 2: Click "creating a new file"
- 4 Step 3: Use the Forward-Slash Character to Create a New Folder
- 5 Step 4: Confirm Folder Creation
- 6 Discussion
The process is super easy but it takes some getting used to compared to typical OS-approaches. Essentially, it's a matter of typing in a forward slash to indicate folder structure. There are some gotchas, however, but below is a step-by-step walkthrough on how to add a folder in Github.
Overview
The steps for creating a folder in a GitHub repo are simple but not immediately clear. Two rules: you must have a repo and you can't create empty folders. Provided you satisfy those conditions, the following steps will result in a new folder:
- Make sure you're in an existing repository
- Click
"creating a new file"
if the repo is empty orAdd file > Create a file
if not. - Type the name of the folder in the input field, followed by a forward slash character.
- Type the name of the new file you wish to create in the folder. Note: GitHub doesn't allow the creation of empty folders.
Step 1: Have a Repository
The first step should be self-explanatory but let's not assume anything. From your profile page, click the repositories tab > create new repository
. Alternatively, you can navigate to an existing repo in which you want to create a new folder. It's worth noting: you cannot use the forward-slash character when creating a new repository—it's automatically replaced with a hyphen character as illustrated in the following image:
Step 2: Click "creating a new file"
Once you've created a new repo, or selected an existing one, navigate to that repo. Once there, if the repo is empty, you will be shown several default messages illustrating various actions you can take. Among them, within the first option, is a hyperlink with the anchor text "creating a new file" as shown in the image directly below. Click it.
If you want to create a new folder in a repo with existing contentyou'll be shown a slightly different screen. Rather thancreating a new file, click the "Add File" and then select the "Create new file" option from the drop-down menu.
This step, as well as the one from a new repo, will both result in the correct new file creation dialog appearing.
Step 3: Use the Forward-Slash Character to Create a New Folder
After clicking the "creating a new file" link you'll be taken to the file creation dialog. Here, you'll be facing a blank input field where one typically types the name of the new file being created.
Type the desired name of your new folder followed by a forward slash. After the forward-slash character is detected, Github will automatically generate a new input field for the file, while recognizing the first input as a new folder name, as shown in the illustration below:
Once your folder name and new file name are correctly typed, scroll down to the bottom of the page and click the green "create file" button. Optionally, you can enter a commit message and description.
[alert type=white ]Note: GitHub will not allow the creation of an empty folder. You must create a file—even a blank one—or the [/alert]
Step 4: Confirm Folder Creation
If you completed each of the above steps, you should now have a new folder in your Github repo. this will be evidence by the repot url in the main navigation area along with the newly-created folder name in the secondary navigation area, as shown in the image below:
Discussion
GitHub is an incredible tool for developers around the world. It's amazing that so many of its features are free to use. Despite its magnificence, certain tasks like creating a new folder in a GitHub repository aren't as straight-forward as one might think. Fortunately, at least in the case of sub-directory creation, there are workarounds that are simple enough!
How To Create A Folder In A Repository In Github
Source: https://www.alpharithms.com/how-to-create-a-folder-in-github-repos-463022/
Posted by: davisbrounally.blogspot.com
0 Response to "How To Create A Folder In A Repository In Github"
Post a Comment