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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:30:40+00:00 2026-05-25T22:30:40+00:00

I need to create a central Git repository but I’m a little confused… I

  • 0

I need to create a central Git repository but I’m a little confused…

I have created a bare repository (in my git server, machine 2) with:

$ mkdir test_repo
$ git --bare init

Now I need to push files from my local repository (machine 1) to the bare repository (machine 2). I have access to machine 2 by SSH. The thing is that I think I don’t understand the concept of a bare repository…

What is the right way of storing my code in the bare repository? How can I push changes from my local repository to the bare repository?

Is the right way of having a central repository to have a bare repository?

I’m a little confused with this subject. Please give me a clue on this.

  • 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-25T22:30:41+00:00Added an answer on May 25, 2026 at 10:30 pm

    Firstly, just to check, you need to change into the directory you’ve created before running git init --bare. Also, it’s conventional to give bare repositories the extension .git. So you can do

    git init --bare test_repo.git
    

    For Git versions < 1.8 you would do

    mkdir test_repo.git
    cd test_repo.git
    git --bare init
    

    To answer your later questions, bare repositories (by definition) don’t have a working tree attached to them, so you can’t easily add files to them as you would in a normal non-bare repository (e.g. with git add <file> and a subsequent git commit.)

    You almost always update a bare repository by pushing to it (using git push) from another repository.

    Note that in this case you’ll need to first allow people to push to your repository. When inside test_repo.git, do

    git config receive.denyCurrentBranch ignore
    

    Community edit

    git init --bare --shared=group
    

    As commented by prasanthv, this is what you want if you are doing this at work, rather than for a private home project.

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

Sidebar

Related Questions

I need create clone repository. but I do not know where can I get
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
I need create a server side game loop, the problem is how to limit
Need to create a custom DNS name server using C which will check against
Hallo, i need to create a feature for the Central Administration in SharePoint 2010,
I need to create a Clearcase label script to run on a UNIX server.
Newbie alert! OK, I have a working central Mercurial repository that I've been working
I need to create a wordpress plugin to connect wordpress to a central login.
I have a few desktop machines at different geographical locations. I need to create
I have a GIT repository that I manage for my office. Because of company

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.