I have created a program in my personal computer and I want to upload all its files into an empty GitHub repository.

I cannot do so from GitHub GUI because some of these files are directories and currently GitHub GUI rejects uploading directories.

Could I use Git to upload these files, perhaps by a "pull request" to the empty GitHub repository (which I would later approve from GitHub GUI)?

I would prefer a solution without SSH.


I was wrong, it is possible to upload directories to GitHub GUI directly;
It's just that the Windows 10 Home upload modal mislead me;
A GitHub support member used another upload modal (of Mac OS) which has a more intuitive upload modal instead the "Open" button in the Windows modal, but, after minimizing the modal I could drag the directory and upload it this way.
Marking the directory and click "Open" didn't cause uploading as it would with non directory files.

1 Answer 1


If you visit your empty repository on GitHub using a web browser, you’ll see instructions explaining how to populate it (see this empty repository for example):

  1. Prepare a directory containing everything you want to upload, if you haven’t already done so.

  2. Initialise a git repository inside it:

    git init
  3. Add all the files and directories, and commit this:

    git add -A
    git commit -m "Initial import"
  4. Match the branch to that expected by GitHub:

    git branch -M main
  5. Add your GitHub repository as a “remote” (this assumes you’ve set up an SSH key):

    git remote add origin [email protected]:roiko/foo.git

    (replace the URL as appropriate).

  6. Push your contents:

    git push -u origin main
  • All of the program's files in my computer are already in a standalone directory but still, I don't want to upload that directory as a new repository, rather I want to upload all its files into an existing empty repository without SSH.
    – Roiko
    Commented Nov 14, 2021 at 18:30
  • Nothing about my answer assumes a new repository, just an empty one. Commented Nov 14, 2021 at 18:33
  • You don’t have to set up SSH, GitHub will show appropriate instructions if you haven’t. Commented Nov 14, 2021 at 18:34
  • I mean, what is the meaning of Initialise a git repository inside it if the repository already exists in GitHub?
    – Roiko
    Commented Nov 15, 2021 at 3:51
  • Add all the files and directories, and commit this because the files are already contained in the directory, I don't understand this saying (maybe you meant "add them all to Git").
    – Roiko
    Commented Nov 15, 2021 at 3:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .