0

I am trying to make changes to a git repository, but I keep running into the same error, and none of the dozens of guides I can find seem to be helping, so I'll explain what I'm doing step by step and hopefully someone can help point out where I'm going wrong (And before anyone points me to it, I've already read Git won't add any files - just an empty directory )

  • Create a new folder in my files
  • clone github repository to folder with

    $ git clone [url.git]

  • copy Project folder with multiple files in it and paste it in desired location inside cloned git folder

  • add and commit at the new folder level and every level above it with multiple add commands

    $ git add .
    $ git add * -f
    $ git commit -m "comment"
  • Push to online repository

    $ git push origin master

However, once I do all this, I go to the web interface and see that the folder that I added is there, but it's entirely empty. It has none of the files that were contained inside. Despite this, git keeps telling me that everything is up to date and there are no changes.

$ git status returns this value:

On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Community
  • 1
  • 1
user6462035
  • 233
  • 2
  • 4
  • 11
  • "add and commit at the new folder level and every level above it with multiple add commands" sounds odd. Try going to the top git level (where you did `git clone`, then add the folder with the copied files `git add YourFolder`. Check what will have with `git status`. If you approve, try `git commit -m Message` and `git push` – Paul Hicks Jun 15 '16 at 00:17
  • What does `git show --oneline --name-only` output? – ElpieKay Jun 15 '16 at 00:38
  • @Paul Hicks: I did try that at first but was getting the same errors, and adding at multiple levels was my attempt to fix the issue. – user6462035 Jun 15 '16 at 00:43
  • @ElpieKay : That command returns 0af07cb Add files via upload data/binaryTrainLabels.dat Which is a data file which another user added, unrelated to the folder I'm trying to add. – user6462035 Jun 15 '16 at 00:45
  • 1
    What about the `git status` output, after `git add`? You could put the information into your question. – Paul Hicks Jun 15 '16 at 01:00
  • So after you did `git add`, you then have `git status` reporting that nothing was added? There's your issue. You may need to include more specific details: path to your (local) git repository, path to the new files being added to the repository, current working directory when you're issuing the various commands, exact output of each command, etc. – Paul Hicks Jun 15 '16 at 01:47
  • Can you post a screenshot of GitHub showing the directory _that contains_ the empty folder? Git doesn't store empty folders, it has no mechanism to create it. So either the folder _actually_ empty, or it isn't _actually_ a folder. – Edward Thomson Jun 15 '16 at 05:44
  • @user6462035 Any update on this? – Kay Jun 19 '16 at 16:05

2 Answers2

0

Make sure that the url of the github repo, and the github url of the upstream is the same.

To check the upstream url, type the following in the terminal where your git repo is:

git remote show origin

Check both the fetch and push urls.

0

There might be an issue from the editor's side,

make sure you are saving the changes to your file. do cmd+S / ctrl+S and then try

git status and subsequently add, commit and push.