Search code examples
gitversion-controlgithubgit-push

why i cannot push mirror to github?


i can sync origin using

git fetch origin

i am on master branch, origin is a bare repo.

also i can run to push changes to github:

git push github  --all
git push github --tags

but why latest commits get using git fetch origin cannot be pushed to github?

when i push, git just replies with: Everything up-to-date

this means that push is in fact not happened :( since the latest commits fetched from origin is not pushed to github, why?

// this is local mirror of origin, and i want to push it to github

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
[remote "origin"]
        fetch = +refs/*:refs/*
        mirror = true
        url = http://git.mirror.xxx.xx/xxx/root.git
[remote "github"]
        url = git@github.com:username/xxx.git
        fetch = +refs/heads/*:refs/remotes/github/*

Solution

  • git fetch will fetch all the remote tracking branches for origin.

    But if those new commits don't concern your current local branch, git push github won't update anything regarding said (already up-to-date) current branch.
    (depending on the current git push policy, and your git version)

    You can try a git push --mirror github, in order to push all refs to GitHub.
    But you will need first to fetch branches from github: git fetch github, in order for your local repo to know about said matching branches.