How to upload an entire folder?

I clicked on my repo in a browser, then I clicked on Upload Files. I would like to upload an entire folder so that GitHub would preserve the hierarchy of the files and folders in my folder, but I am not able to select folders to be uploaded. How would I upload an entire folder of an XCode project?

7 Likes

There isn’t a way to upload an entire folder through the web UI. The easiest way to do that would be to:

  1. Clone the repository locally
  2. Make the changes to the local version
  3. Commit the changes locally
  4. Push the changes back up to the GitHub repository

You can find out more information about this process in our help documentation. Let us know if you have any questions.

12 Likes

you should just try to drag and drop your entire folder in the webui and it will upload whole folder.

70 Likes

Wanted to confirm here, that dragging and dropping a folder into the Web UI will now, indeed, create that folder in (and upload the files within it to) your GitHub repo. See: https://help.github.com/articles/adding-a-file-to-a-repository/ for more info.

3 Likes

I have tried to upload a folder with drag and drop option but it’s not working. So can you please suggest me how to upload an entire folder?

15 Likes

@siva-tn Is the repo you’re trying to upload the folder to public? If so, can you share the link to it? Also, what file formats are contained in the folder you’re trying to upload? 

Or use command line:

cd into the directory where your folder is located

type:

git init
git add <folder1> <folder2> <etc.>
git commit -m "Your message about the commit"
git remote add origin https://github.com/yourUsername/yourRepository.git
git push -u origin master
git push origin master
42 Likes

I have tried to drag the folder but it shows folder contains more than 100 files, try with less number of files, is there another way to do so?, i have nearly train_data images in my folder.

6 Likes

Didn’t work  in FF. GC worked fine though…

1 Like

not working, only files were uploading not entire folder.

1 Like

how to set path format in git add <folder>

Folder upload only works if contains less than 100 files.

I’m trying to drag and drop the build folder of a small react app and it doesn’t let me drop it in the web interface. Seems to be less than 100 files in the directory… Any idea what the problem might be?

Same here (once I’d worked out whatr FF and GC were). Something odd in Firefox I guess.

I have this problem too, I’ve created a new Repo on my Windows 10 Github Desktop, and it won’t upload some directories (e.g. build, lib) to github.com, the directory lib only has one binary file, can someone help how to solve this problem? Thanks,

Thanks man, It worked.

My Error:

remote: Permission to Jean-Laurore/BookLibrary.git denied to jelaurore.

fatal: unable to access ‘https://github.com/Jean-Laurore/BookLibrary.git/’: The requested URL returned error: 403

Using the ‘Upload files’ button allows uploading fewer than 100 files.

Try GIT Bash, use the following codes to upload the whole folder.

  1. Open Git Bash.
  2. CD projectname
  3. $ git init
  4. $ git add .
  5. $ git commit -m “First commit”
  6. $ git remote add origin remote repository URL
  7. $ git remote -v [Note: Verifies the new remote URL]
  8. $ git push origin master

Thank you!

Manika Sahu

3 Likes

Hey there, how can I set repository in cmd when my git folder lies on desktop?

Thank you so much.

I seem been having the same problem.

what.casino