Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Beginner’s guide to GitHub: Uploading files and folders to GitHub

    Beginner’s guide to GitHub: Uploading files and folders to GitHub

    July 8, 2024

    Welcome back to GitHub for Beginners, a series designed to help you navigate GitHub with ease.

    If you’ve been following along, we’ve covered some basics of Git and GitHub, including the top Git commands every developer should know and how to create repositories. Now that you have a repository, you can use it to track file versions or collaborate with others. However, first you need to upload your files to the repository.

    Let’s get started!

    How do I upload files?

    There are multiple ways you can upload content to GitHub, and we’ll go through a few of them. The first option we’ll cover is uploading using GitHub.com.

    To upload a file to GitHub, you’re going to need a repository to upload the files to. We covered this in our previous how to create repositories blog, but as a quick refresher, you’ll need to click the button or menu option for creating a new repository. On the next screen, select an owner for the repository, give it a name, provide a description, choose whether it is public or private, and initialize it with a README.md file. Then, click the “Create repository” button.

    Once you’re in your repository, click on the plus button next to the green button that says “Code.” Select “Upload files” from the menu. On the next screen, click the link that says, “choose your files.” This opens up a file browser and you should select the files you want to upload.

    Depending on the size of the files, it might take a moment for them to upload, but you can see the files being added to your commit on the main screen. It’s important to realize these files aren’t uploaded to the repository yet. You still have a couple of short steps to go.

    Next, add a commit message in the box under the list of files to be added. You can leave the default commit message, but it’s often helpful to provide a brief description of the changes you’re making. This gives anyone with access to your repository insight into what changes were made. Next, click the green button that says, “Commit changes.”

    Now your files will be uploaded to your repository! This is a great way to add small files to GitHub. However, there’s another way that can be more convenient for uploading large files, folders, and entire projects.

    How do I upload files using the terminal?

    Before we use the terminal, we should create a new empty repository. In GitHub, click the plus button at the top and select “New repository.” This time, only enter a name and a description. We want the directory to be completely blank. We decided to call our repository python-game.

    Click the green “Create repository” button.

    After your repository is created, you’ll see a window with some instructions and a list of Git commands you can use from a terminal. These are the steps we’re going to follow to push our files to GitHub.

    On your local machine, open a terminal and navigate to the project folder you want to upload. In our case, that’s the python-game directory, so we run cd python-game from the projects directory.

    The first step is to run git init in the folder. git init initializes the folder and organizes it so that it can be used as a repository.

    Next, we want to add a README.md file with a brief description, so let’s run touch README.md to create the file. You can now open the file (in the terminal or your file manager) and add a brief description that describes the repository.

    Now, we need to tell Git which files to add to the repository. We do this by running the git add . command. This adds all of the files in our current directory to staging. The next step is to run git commit -m “initial commit” to create a commit with a description of “initial commit.” A commit is like a snapshot of the current state of the files in your local repository.

    To make sure everything worked, run git status and verify that all the files are ready to be pushed. You should see a message indicating that your working tree is clean.

    Now, run git branch -M main to set the main branch. The next step is to connect your local repository to the repository on GitHub. You do this by running git remote add origin <URL> and replacing the with the URL provided on the GitHub instructions page when you created the repository. This essentially tells Git “this is where I want you to put these files.”

    The final step is to run the git push -u origin main command. This sends all of the files to GitHub. Go back to your browser and refresh the page. You should see the files uploaded to GitHub and residing in your repository! Congratulations!

    Now, if you already initialized Git in your project on your machine, and you just need to upload your files to a remote repository, you wouldn’t need to run git init at the start. You’d follow the rest of these steps, but skip that initial one.

    What’s next?

    Now that you have learned how to add files and folders to your repositories, it’s time to start using them to collaborate with others or add version tracking to your files!

    If you have any questions, pop them in the GitHub Community thread and we’ll be sure to respond.

    Here are some more resources to help you on your GitHub journey:

    GitHub Foundations Certificate
    Adding a file to a repository
    Deleting files from a repository
    Large files on GitHub

    The post Beginner’s guide to GitHub: Uploading files and folders to GitHub appeared first on The GitHub Blog.

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleDistribution Release: NethSecurity 8.1
    Next Article 5 Tips for Improving Your Team’s Productivity (Free Download)

    Related Posts

    Machine Learning

    Salesforce AI Releases BLIP3-o: A Fully Open-Source Unified Multimodal Model Built with CLIP Embeddings and Flow Matching for Image Understanding and Generation

    May 16, 2025
    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Microsoft confirms Windows 11 24H2 installation issues, newer updates fail for some PCs

    Development

    Samsung’s $99 Galaxy Watch is the best WearOS deal right now – here’s how to qualify

    Development

    Generating fashion product descriptions by fine-tuning a vision-language model with SageMaker and Amazon Bedrock

    Development

    Anche il Team Debian abbandona X (ex Twitter): una scelta in linea con i propri valori

    Linux

    Highlights

    WhatsApp privacy is ‘broken,’ reveals proof-of-concept hack

    April 9, 2025

    WhatsApp’s privacy settings are “broken” and can be bypassed by downloading a simple bit of…

    This AI Paper from Tencent AI Lab and Shanghai Jiao Tong University Explores Overthinking in o1-Like Models for Smarter Computation

    January 1, 2025

    How Sitecore Drives Digital Strategy Value as a Composable DXP

    February 1, 2025

    How to Fix ERROR_RXACT_COMMIT_NECESSARY

    January 22, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.