Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9241317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:20:58+00:00 2026-06-18T08:20:58+00:00

I have a bare git repository that I use to push to and pull

  • 0

I have a bare git repository that I use to push to and pull from on a linux machine (let’s call the bare git repository remote originlinux). From my working repository that has originlinux as a remote I push and pull until finally I decide to put it on github. I add the repository for github on their web gui and add the remote repository on my working repository (let’s call the remote origingithub) using the git remote add command followed by git pull --rebase, then git push (pull before push since I wasn’t allowed to simply push to a newly created github repository without getting one of these: ‘hint: Updates were rejected because the tip of your current branch is behind’. I figure this has something to do with their option to create a readme file). And here’s the issue, after performing these steps, the originlinux repository is completely not synced with the origingithub repository even though they have exactly the same commits and were pushed to from the same exact working repository. Could someone please explain in good detail why this occurring and also what I could do differently to prevent this from happening without reordering how I create my remote repositories? It seems like the workflow or order of operations I’m using doesn’t make sense in git land, but how else would you keep multiple remote repositories sync’d on one working copy?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:21:00+00:00Added an answer on June 18, 2026 at 8:21 am

    The two repositories do not have the same commits.

    When you did git pull --rebase, you rewrote the entire history of the project so that every revision contains that readme file. So every commit in the history will have a different SHA1 identifier.

    There are a couple of ways that you may be able to recover from this.

    First, you could revert the state of your local repository to match the state or your first (non-github) remote. This would eliminate the readme file that you created on github (you can copy that to some other location and add it back in to git later if desired), along with any changes that you hadn’t pushed to the first remote (including changes that haven’t been committed).

    git reset --hard originlinux/master
    git push -f origingithub
    

    The -f option there causes the push to be forced even though that is removing some commits. This is something that should be avoided in general, but it is sometimes necessary such as in this case.

    The other option would be to just do a force push to your first remote, accepting the new history caused by the rebase.

    git push -f originlinux
    

    If the three repositories that you mentioned are the only ones, it shouldn’t matter much which of these methods you use. If there are other repositories you may want try to determine which version of the history is more widely known, and keep that version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a central Git bare repository. When a push is made to that
I have a Git repository on my local machine that I cloned from my
From my Workstation, I can push modification to a git bare repository on my
I have a remote bare repository (no working dir) that creates install-tars. Works nice.
I have a remote server on which I have created a bare git repository.
I have a bare git-svn repository and did a 'git svn fetch' on it.
I have created a bare git repo (lets call it repo #1) and cloned
I have a remote web server that I have full access to (ssh, git,
I have a bare repository that's used as the central store for my project.
Summary: What I'd like to accomplish is to periodically push a bare Git repository

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.