Introduction
Introduction Statistics Contact Development Disclaimer Help
Title: Git push to non-bare repository
Author: Solène
Date: 17 May 2016
Tags: git versioning solved
Description:
Hello
You have a git repository where you work in, and you would like to
work on a clone of it and push the data back to it ? You may encounter
issues if your git repository isn't a bare one. I have been facing
this problem by using gitit, which works with a non-bare git
repository.
$ git init --bare repo
$ ls -a repo/
. HEAD config hooks objects
.. branches description info refs
You can't work in this, but this is the kind of repository that should
be used to store/push/clone etc..
$ ls -a repo2
. .. .git
You may use this one for local use, but you may want to clone it
later, and work with this repository and doing push/pull. That's how
gitit works, it has a folder "wikidata" that should be initiated as
git, and it will works locally. But if you want to clone it on your
computer, work on the documentation and then push your changes to
gitit, you may get this error when pushing :
### Problem when pushing ###
push, but no...
Décompte des objets: 3, fait.
Écriture des objets: 100% (3/3), 232 bytes | 0 bytes/s, fait.
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'.
! [remote rejected] master -> master (branch is currently checked
out)
git is unhappy, I can't push
repository with this command :
$ git config --local receive.denyCurrentBranch updateInstead
Now you should be able to push to your non-bare repository.
Source: [Stack Overflowk link where I found the
solution](http://stackoverflow.com/questions/1764380/push-to-a-non-bare
-git-repository)
You are viewing proxied material from dataswamp.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.