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

  • SEARCH
  • Home
  • 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 6108585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:18:41+00:00 2026-05-23T14:18:41+00:00

Configuring and working with git locally seems to be working fine: ~/sb> mkdir proj1

  • 0

Configuring and working with git locally seems to be working fine:

~/sb> mkdir proj1
~/sb> cd proj1
~/sb/proj1> echo "asdf" > file1.txt
~/sb/proj1> git init
~/sb/proj1> git add .
~/sb/proj1> git commit -a -m "Import"
~/sb/proj1> git branch
* master

The problem begins when I try to push this to a central repository:

~/sb/proj1> cd /home
~> mkdir temp-repo
~> cd temp-repo/
~/temp-repo> git init --bare
Initialized empty Git repository in /home/temp-repo/
~/temp-repo> cd ~/sb/proj1/
~/sb/proj1> git clone /home/temp-repo/
Cloning into temp-repo...
done.
warning: You appear to have cloned an empty repository.
~/sb/proj1> git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Note: The --bare and origin master above were taken from a solution to a problem posted here: pushing to a git repository does not work

Yet, I don’t seem to figure out what I am missing. Must be something trivial, but what is it?

UPDATE: The answer by @Firoze Lafeer below works:

~/sb/proj1> cd /home
~> mkdir temp-repo
~> cd temp-repo/
~/temp-repo> git init --bare
Initialized empty Git repository in /home/temp-repo/
~/temp-repo> cd ~/sb/proj1/
~/sb/proj1> git remote add origin /home/temp-repo
~/sb/proj1> git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 230 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /home/temp-repo
 * [new branch]      master -> master
~/sb/proj1>

Now I need to understand why. In particular, what did I misunderstand in this answer which suggests doing a git clone before git push origin master.

  • 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-23T14:18:42+00:00Added an answer on May 23, 2026 at 2:18 pm

    When you did:

     git clone /home/temp-repo/
    

    you should now have a clone of the repo in a new directory ~/sb/proj1/temp-repo/

    If I’m understanding your question correctly, that’s not what you wanted.

    If you already have a repository in ~/sb/proj1 then don’t clone the other repository. Just add the other one as a remote.

    So assuming you created the local repo first in ~/sb/proj1 and then created the temp-repo and you want to push from the first to the second:

    git remote add origin /home/temp-repo
    git push origin master
    

    Or just do it the other way around. Make the repo in /home/temp-repo first and then clone it and push to it.

    Hope that helps?

    edit

    To hopefully further explain why do didn’t want clone here:

    A clone is in the case where you haven’t already created a local repository. So you’re asking git to copy some remote repository, which then implicitly sets it as the remote called ‘origin’ in the new local copy. In your case, you already had a local repo, so all you wanted is to set the other repo as the remote called ‘origin’.

    So now your local repo is aware of another repo called ‘origin’. And then you can push to that ‘origin’. You don’t have to call it ‘origin’ of course, you could call it ‘cats’ and then ‘git push cats master’ if you like.

    OR you can do it the other way around. So you could make the temp-repo first and then do something like:

    cd ~/sb
    git clone /home/temp-repo proj2
    cd proj2
    # make some changes...
    git push origin master
    

    That works, too. That copies temp-repo into a new repo in a new directory proj2. Then in proj2 that new repo is aware of a remote repo called ‘origin’ (/home/temp-repo), so can push commits back to it.

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

Sidebar

Related Questions

Hallo, I am configuring Solr. Everything ist working fine but one thing appears to
I'm working on configuring a RollingFileAppender in log4net programmatically. I have something like this
Working on a somewhat complex page for configuring customers at work. The setup is
When configuring the bash on OSX via ~/.profile it seems to completely ignore it
I've just started working with GlassFish (3.1.1) and especially with configuring an LDAPRealm. I
I'm configuring my solr for two cores and have got most of it working,
I'm working on an Outlook 2010 add-in that provides a dialog for user input.
I have working copy of war file which is working fine in windows.. Now
I am currently working on configuring my CakePHP (1.3) based web app to run
I am working on Configuring and manipulating and controlling IIS 6.0 and later versions

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.