All of lore.kernel.org
 help / color / mirror / Atom feed
* Unable to push to local bare repository
@ 2021-01-20 21:58 Rich Davis
  2021-01-20 23:59 ` asymptosis
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Davis @ 2021-01-20 21:58 UTC (permalink / raw)
  To: git

Hello GIT Community,

I have a question concerning initialization of bare repositories on a
local system; what am I overlooking?

I am attempting to init a bare repository locally, then clone the bare
repository to add files, then commit and push the content back:

========== Start Example ==========

$ git init barerepo
Initialized empty Git repository in /tmp/am_i_crazy/barerepo/.git/
$ git clone --dissociate --no-hardlinks --no-local barerepo clonerepo
Cloning into 'clonerepo'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
$ cd clonerepo/
$ echo "This is a test file created on $(date +%Y-%m-%d_%H:%M:%S)" >
test.txt
$ git add test.txt
$ git commit --message "Initial commit."
[master (root-commit) da5f435] Initial commit.
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 914 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare
repository
remote: error: is denied, because it will make the index and work tree
inconsistent
remote: error: with what you pushed, and will require 'git reset --hard'
to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration
variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow
pushing into
remote: error: its current branch; however, this is not recommended
unless you
remote: error: arranged to update its work tree to match what you pushed
in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default
behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to
'refuse'.
To /tmp/am_i_crazy/barerepo
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/tmp/am_i_crazy/barerepo'
$ git version
git version 2.7.4
========== End Example ==========

From what I was able to find in the man page, there is an optimization
that takes place locally when the upstream repository is on the same
system / file system; I have attempted to disable that, but I am unsure
if that is what is causing the problem. I am also curious as to why the
error message refers to the upstream repository as "non-bare"?


Thank you for your time,

Rich Davis*
*



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-21  0:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 21:58 Unable to push to local bare repository Rich Davis
2021-01-20 23:59 ` asymptosis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.