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 5841315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:52:30+00:00 2026-05-22T11:52:30+00:00

I have an existing Git repository on Github. I wanted to reorganise my code,

  • 0

I have an existing Git repository on Github.

I wanted to reorganise my code, so I started a new project, let’s called it NewApp. I have made the NewApp folder into a git repository by calling git init.

I have then staged the changes and committed them.

I then added the repository

git remote add github github@github.com:myAccount/myRepo

I now want to push to the repository under branch named development. So I use git push github development

After which I get the error error: failed to push some refs to git@github.com:myAccount/myRepo.git

All the explanations that I can find on the Internet suggest you first have to do a git pull from this branch. I don’t want to do that because it will give me the old code which is totally different. But I did it anyway, and then changed the code, but it still didn’t work for me.

What is going on. Why can’t you just overwrite what’s currently in a particular branch?

  • 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-05-22T11:52:30+00:00Added an answer on May 22, 2026 at 11:52 am

    By creating a new repo (git init), you are effectively making a new root commit, that you won’t be able to push to an existing repo.

    A git pull wouldn’t solve anything, since there would still be two root commits.

    For your reorganization, I would rather recommend making a branch from an existing commit (meaning, cloning your existing repo and making a branch in that cloned repo), instead of initializing a brand new repo.

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

Sidebar

Related Questions

I have an existing git repository with a reasonable amount of history that I
I have an existing C++ project on a linux environment, and would like to
I have an existing website that uses the same code base, but is deployed
I'm really quite frustrated at this point. I have an existing hg repository that
I have some code that I want to put into an svn repository for
I have git repository (powered by gitosis) on my local ubuntu server I want
I have a svn repository that I migrated to git using the tool svn2git.
So I have a git repository that i pulled at one point and that
I'm currently looking to convert an existing SVN repository to git, and then to
I have existing Java application that is using Acegi for authentication/authorization. Our new web

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.