git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unable to push to local bare repository

From
Aasymptosis <asymptosis@posteo.net>
Date
Jan 20, 2021, 23:59 UTC
Message-ID
<YAjD+Gtm1QwdwXCq@sleipnir.acausal.realm>
In-Reply-To
<8f1df022-0e0e-2451-b32d-2d9918604ea1@gmail.com>
Hi Rich,
>$ git init barerepo
>Initialized empty Git repository in /tmp/am_i_crazy/barerepo/.git/
This looks like your problem: without passing the --bare flag, it's not a bare repo. It even says it's initialized under barerepo/.git instead of barerepo.
Compare with the result of passing --bare:

``` testuser /tmp $ git init --bare barerepo Initialized empty Git repository in /tmp/barerepo/

testuser /tmp $ git clone --dissociate --no-hardlinks --no-local barerepo clonerepo Cloning into 'clonerepo'... warning: You appear to have cloned an empty repository.

testuser /tmp $ cd clonerepo/

testuser /tmp/clonerepo $ printf "This is a test file created on %s\n" "$(date +%Y-%m-%dT%H:%M:%S)" | tee test.txt This is a test file created on 2021-01-21T10:55:35

testuser /tmp/clonerepo $ git add test.txt
testuser /tmp/clonerepo $ git commit -m "Initial commit"
[master (root-commit) b71804b] Initial commit
  1 file changed, 1 insertion(+)
  create mode 100644 test.txt
testuser /tmp/clonerepo $ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 253 bytes | 253.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To /tmp/barerepo
  * [new branch]      master -> master
```
Hope this helps.
Previous: Rich Davis
Message 2 of 2 in “Unable to push to local bare repository”
  1. Rich DavisJan 20, 2021
  2. asymptosisJan 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.