3

As I understand it, under the main page of the repository there should be a button to create/upload new file to the left of "Username / Repository Name" in the GitHub web interface. There is not.

According to this question, I should be able to drag and drop while under the Repository -> "Code" tab. This is not possible either.

*Using Firefox, Javascript is enabled.

UPDATE

This is the page I am viewing: it is the main page for a selected repository. It must be the wrong the place. I have redacted my profile and repository name, but rest assured there is not a "Create New" or "Upload" button under any of them. The "+" in the upper right hand corner has been expanded to show there are no options like these here either. The portion covered by the expanded "+" button does not contain the links either.

Github Respository Main Page

2
  • Do you have permission to do so? Commented Apr 14, 2017 at 17:03
  • @EightDaysofMalaise It is my repository.
    – user58446
    Commented Apr 15, 2017 at 17:47

2 Answers 2

3

GitHub's web interface will not show the File Upload button until you've made your first commit.

When working with Git, every repository needs to be initialized with a starting set of files to work from, typically, in the form of a README file. Strangely, GitHub does not allow you to make this first commit by uploading files from the web interface.

There are two ways to make your first commit:

Initialize with a README

When creating a new repository, you can check Initialize this repository with a README to create the first commit for you.

Initialize with readme

Push commits to an existing project

If your repository was already created, you can use the Git command line to push commits from your PC.

  1. Open Git Bash.
  2. Change the current working directory to your local project.
  3. Initialize the local directory as a Git repository.

    git init
    
  4. Add the files in your new local repository. This stages them for the first commit.

    git add .
    # Adds the files in the local repository and stages them for commit.
    # To unstage a file, use 'git reset HEAD YOUR-FILE'.
    
  5. Commit the files that you've staged in your local repository.

    git commit -m "First commit"
    # 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.
    
  6. At the top of your GitHub repository's Quick Setup page, click the clipboard icon to copy the remote repository URL.

  7. In the Command prompt, add the URL for the remote repository where your local repository will be pushed.

    git remote add origin remote repository URL
    # Sets the new remote
    git remote -v
    # Verifies the new remote URL
    
  8. Push the changes in your local repository to GitHub.

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

GitHub: Adding an existing project to GitHub using the command line

4
  • 2
    I had my own readme, so I disabled this option. They should make this more clear. Marked as the answer.
    – user58446
    Commented Apr 15, 2017 at 18:51
  • @user58446 Agreed, anyone not familiar with GitHub might not know to pick that option.
    – freginold
    Commented Apr 15, 2017 at 19:01
  • Also note, that the default README.md contains the project title and description. Not sure if deleting this will remove this metadata... don't want to find out now. Just thought I'd point this out.
    – user58446
    Commented Apr 16, 2017 at 19:22
  • @user58446 Overwriting the default README shouldn't cause any issues. The .MD file controls what's shown below the files on your repository's main GitHub page
    – Stevoisiak
    Commented Apr 16, 2017 at 19:44
0

If you already created an empty directory and are faced with GitHub's wall of advice, looking for "create new file" or "upload new files", the solution is to click the word "README". It opens text editor for README.md file, but you can change the file name to something else if you want. This allows you to create the first file in the repository, and then things are back to normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.