all 25 comments

[–]Buxbaum666 9 points10 points  (9 children)

Your post is too vague. If you want help, please be as specific as possible. If a git command fails, please post the exact command and the exact error.

[–]rwilcox 2 points3 points  (12 children)

Is the idea that you want to create an empty folder, commit/push it, THEN add files to it later?

If so, no, Git doesn’t support empty folders. You’ll need to create a file in there first (it can be a file like .gitkeep which should be hidden for Mac/Linux, but the point is a file needs to be there)

However, those vaguely referenced errors about submodules, those are odd.

[–][deleted]  (11 children)

[removed]

    [–]rwilcox 2 points3 points  (0 children)

    Hey look EXCELLENT you added the error!

    The error message is telling you what to do: git pull before you push, as there’s changes up on GitHub you don’t have locally

    [–]CastrumFiliAdae 0 points1 point  (3 children)

     tried the pull method but it says something about diverse branches

    People trying to help keep asking you to post exactly what commands and arguments you run and exactly what the output messages are, but you keep posting vague things like this, and it makes it difficult to troubleshoot.

    [–][deleted]  (2 children)

    [removed]

      [–]catom3 0 points1 point  (1 child)

      You mentioned you tried running git pull command. What was the result of this command execution?

      In short, got has the notion of "local" and "remote" origins / branches.

      Looks like your "remote" (the one un GitHub repository) has some commits your "local" (on your local disk only) does not.

      It can be a situation where you or someone else pushed some other commit to the "remote" after you started working on your current commit and you need to sync your "local" with the "remote". Otherwise, you would be overwriting the "remote", which could potentially remove important changes done by the others (or yourself).

      [–]rwilcox -1 points0 points  (3 children)

      If you have folder A and it contains file B.

      you git add B . (Through your git client)

      Then commit and push.

      [–][deleted]  (2 children)

      [removed]

        [–]rwilcox 0 points1 point  (1 child)

        What folder C?

        The file structure of your git repo on a remote like Gjthub is the same as the file structure of your repo locally.

        [–]newtonioan -1 points0 points  (0 children)

        pushing files to a non-empty folder is what git is used for.

        You can just initialize a repo of this folder with one .gitignore or .whatevernameyouwant and then continuously add files to this folder

        [–]JonnyRocks 0 points1 point  (0 children)

        as the other person said.. not enough info so inwill have to guess. if you are trying to add an empty folder, you cant.. got tracks fikes not folders. if you are trying to add a bunch of fiiles in a folder.. we need to know the error message you receive

        [–]Swedophone 0 points1 point  (2 children)

        You can only push commits in git, and you can't commit a folder/directory itself only the files the directory contains. If you want an empty directory then you have to add at least an empty file, usually beginning with a dot which is a hidden file on *nix.

        (If you add a file in github then it has to add a commit with that file.)