Add File to Repository

I have looked around so before you say google it could you please just help me.

I am trying to upload a file to a repository that I just created and all it contains is an html option or a ssh option. How should I go about adding a file from my desktop. 

You need to give some more information. If you’ve already set up git on your desktop, you should run:

git add .
git commit -m 'I updated my file.'
git push

Try to run that and share the output with us.

1 Like

You can also add a file to a repository via the web interface by clicking the Upload Files button as shown here:

Screen Shot 2018-03-18 at 5.21.53 PM.png

Hi, I can’t find the Upload button… please help


It looks like you created a new repository without a README or other document. This would explain why you’re not seeing the “Upload File” button.

I’d recommend you start by creating that README. We actually have an article that goes over the whole process of setting up your GitHub account, including your first repository and the importance of a README. I’d recommend going through the “Initialize with a” section for more information.

Since you already created your repository without a README, you can add one by clicking on the “README” link (this is shown in your screenshot under the HTTPS URL). That will start a new README file for you. In the form you’re taken to, you can write a brief description of what your repository is about/for. Once you’ve added the that content to your README file, you’ll need to write a commit message in the “Commit changes” box below the file editor. Writing good commit messages is a subject worthy of it’s own guide, but an example of a good message you could use for this commit would be: “Create”. Then click “Commit directly to master branch”.

Once you’ve done that, you’ll be taken back to your _Code _tab and you’ll now see the “Upload Files” option in the upper right (between “Create new file” and “Find file”). That’s where you can upload an already-existing file to your repository.

You do still have the option, as mentioned by @askyous earlier, to add a file to your repository using the command line (instead of the web UI). To do that, just follow this guide.

I hope this helps! Please let us know if you have more questions.