Add a folder #22534
-
How do we add a folder to a repository? I have searched and searched and I see an icon for a new file, but nothing anywhere for a new folder. Nor did I find the question asked anywhere here on the forum, which I find quite weird. |
Beta Was this translation helpful? Give feedback.
Replies: 20 comments 45 replies
-
Hello @mbrasseau, To create a new folder in a repository click “create a new file.” Type your new folder’s name in the area where you would write the file name, and at the end of the file name type a “/” to initilize it as a folder. After this you can create a new file in the folder. Alternatively, you can clone the repo locally and add a new folder, and then push the changes to github using the command line or Github Desktop. |
Beta Was this translation helpful? Give feedback.
-
Thank you so very much! |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for the solution! What if I want to create a new folder then upload files from the desktop? |
Beta Was this translation helpful? Give feedback.
-
Hello @mukulmc03, welcome to the GitHub Support Community! You can also create new folders by simply dragging and dropping a folder with files to your repository on GitHub and then uploading them. If you want the folder you’re uploading to be inside a specific sub-folder, be sure to click on and enter that sub-folder before uploading your files. |
Beta Was this translation helpful? Give feedback.
-
The suggestion to name a directory as |
Beta Was this translation helpful? Give feedback.
-
You can’t, that’s part of how git works. Git does not track directories other than as parent directories of tracked files. If you want a directory to exist on checkout, you can create an empty file in that directory (common filenames for that purpose would be |
Beta Was this translation helpful? Give feedback.
-
Thank you, it helped me to get started with Github in the way I wanted to. |
Beta Was this translation helpful? Give feedback.
-
On GitHub you can do it this way:
|
Beta Was this translation helpful? Give feedback.
-
I'm new to GitHub, so maybe i didn't get it yet. But to me this seems to be a crucial flaw of this platform. How can a coding platform which is so widely used not support such an essential functionality ... |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
To add a folder to a GitHub repository, you can follow these general steps: Navigate to Your Repository: Upload Files: If the folder you want to add doesn't exist locally on your machine, create it using your file explorer or command line. Open a terminal or command prompt. Navigate to the local repository's directory using the cd command. Use the following commands to add the folder and its contents, and commit the changes: bash
This stages the changes (using git add) and then commits them with a message. Push Changes to GitHub: After committing changes locally, you need to push them to the GitHub repository. bash
Replace 'branch_name' with the name of the branch you are working on (often, it's the 'main' branch). Now, your folder and its contents should be added to the GitHub repository. If you are working with a new repository or need to initialize a new repository on GitHub, you can follow GitHub's instructions when creating a new repository, including a guide on initializing with a README file and adding existing files and folders. You can find these options when creating a new repository on the GitHub website. |
Beta Was this translation helpful? Give feedback.
-
whomever at github thought that adding a "/" to a filename was an appropriate way to create a folder FLUNKED user interface design 101. That is the most asinine non-intuitive poorly thought out way to create a folder i have ever seen in 40 years of software development. it is basically stupid. thanks @SethClydesdale for writing up the answer. it is rather unfortunate that you had to do because of github's poor UI design |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Thanks #1 |
Beta Was this translation helpful? Give feedback.
-
Thank you so much |
Beta Was this translation helpful? Give feedback.
-
To create a new folder in a repository click “create a new file.” Type your new folder’s name in the area where you would write the file name, and at the end of the file name type a “/” to initilize it as a folder. After this you can create a new file in the folder. |
Beta Was this translation helpful? Give feedback.
-
not working |
Beta Was this translation helpful? Give feedback.
-
There is someone who uses my account to play Xbox One for free and I have been paying for it for a year to avoid the extra revenue it costs for Microsoft. And for a year I paid and I am unemployed and during that time I had to stop paying another account to pay for x box. I don't want to file a police report because I hope the people behind this will give me my money back. My email is [email protected] I expect a response soon and if I had a job I wouldn't mind because I would have a lot more money. I have been unemployed for 8 years and I only have help from some projects from the unemployed fund, I don't know but it is unfair that I am paying for a luxury that I don't want and that I have never asked for and for a while I thought about filing a complaint against the police but I don't think they use the police for this I think people still made a mistake and the - [ ] person can give me the money hjälpa necesito ayuda |
Beta Was this translation helpful? Give feedback.
-
Necesito ayuda |
Beta Was this translation helpful? Give feedback.
Hello @mbrasseau,
To create a new folder in a repository click “create a new file.” Type your new folder’s name in the area where you would write the file name, and at the end of the file name type a “/” to initilize it as a folder. After this you can create a new file in the folder.
Alternatively, you can clone the repo locally and add a new folder, and then push the changes to github using the command line or Github Desktop.