How to Upload Files to GitHub? 2 Easy Methods to Try!

Uploading files to GitHub allows you to store anything on the repository. You can only upload files up to 25 MB in size to a repository using a web browser. Through the use of the command line, you can upload files up to 100 MB in size. Large files (more than 100 MB) must be uploaded using Git’s dedicated Large File Storage feature.

This article will give you clear and concise step by step for uploading files to GitHub. Make sure you follow each step carefully. 

Table of Content

Things You Should Know About Uploading Files to GitHub

Uploading files to GitHub can be done directly on the GitHub website or by using Command Line.

  • The maximum file size allowed in GitHub repositories is limited. For files larger than 50 MB, Git will issue a warning when you try to add or update them.
  • Repositories should be kept modest; less than 1 GB is preferred, and fewer than 5 GB is strongly suggested.

How to Upload Files to GitHub Repository via Website

GitHub is a good platform that allows users to create and manage their repositories. You can follow the steps below on how to upload files to GitHub. Let’s check ‘em out!

  1. Access the repository’s homepage on GitHub.com.
  2. A drop-down menu titled “Add file will appear above the file list; select “Upload files” from this menu.
    upload files to GitHub
  3. Simply drop the files or directories you want to save in your repository into the file tree.
    upload files to GitHub
  4. Type a brief, descriptive commit message that explains the file edits you just made at the page’s end. The commit message might include credit for many authors.
    upload files to GitHub
  5. Choose between the existing branch and create a new one below the commit message fields. If the branch you’re working on is the default branch, you should make a new branch before committing and sending a pull request.
    upload files to GitHub
  6. To save your modifications, select Commit changes.
    upload files to GitHub
See Also  Simple Guide on How to Create Android Studio Path on GitHub

How to Upload Files to GitHub Repository via Command Line

If you have a file that you’d want to add to a repository on GitHub.com, you can do it using the command line. Command line is another method to upload files to GitHub, which is easy.

Note that before attempting this method, you should:

  • Whether you’ve started your own GitHub repository or you’re looking to contribute to an existing one, you’re all set to go.
  • You have successfully cloned the repository onto your own computer.

To upload a file to GitHub from your computer, navigate to the local directory you created while cloning the repository and copy the file there.

  1. Open Git Bash.
  2. Make a working directory change to your personal repository.
  3. Prepare the file to be added to your local repository.

    $ git add .

    # Adds the file to your local repository and stages it for commit. To unstage a file, use ‘git reset HEAD YOUR-FILE’.

  4. Finish up by committing the file you’ve been working on to a local repository.

    $ git commit -m “Add existing file”

    # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use ‘git reset –soft HEAD~1’ and commit and add the file again.

  5. Changes in your local repository should be pushed to GitHub.com.

    $ git push origin your-branch

    # Pushes the changes in your local repository up to the remote repository you specified as the origin


Note:

Do not git add, commit, or push any sensitive information to a remote repository. Some examples of sensitive information are:

  • Passwords
  • Credit card numbers
  • PIN numbers
  • SSH keys
  • AWS access keys
  • API keys

Tips

  • Multiple files can be uploaded simultaneously to GitHub.
  • Using GitHub to make changes to files in a repository’s protected branch is impossible.
  • For other tips and tutorials on GitHub, read more on this page.

Share This Post

Newest Articles

How to Get a GitHub Access Token for Personal Access

No longer have access to your personal GitHub repository? You can use the GitHub Access Token to open it. Read the full guide here!

How to Make a GitHub Repository Private

Developers can now create a private GitHub repository in the free tier as of January 7, 2019. Read how to get the private repository feature on GitHub here!

3 Methods of How to Install Android SDK Repository

Android is one of the most used operating systems for software development. Read the full guide on how to get the Android SDK here!

How to Turn Off Android Developer Mode

Android Developer Options allows you to access hidden features. If you want to deactivate it, follow this simple guide to turn it off!

5 Simple Ways How to Get Cookie Clicker GitHub

How to get and use Cookie Clicker on GitHub? You can find the simple steps and cheats for Cookie Clicker in this article!

How to Integrate Jira with GitHub in 6 Easy Steps

If you use Jira for your work and need to integrate with another organization that uses GitHub, integration is what you require. Read the details here!