stef@medusa:/tmp$ mkdir plop.git
stef@medusa:/tmp$ cd plop.git/
stef@medusa:/tmp/plop.git$ git init
Dépôt Git vide initialisé dans /tmp/plop.git/.git/
stef@medusa:/tmp/plop.git$ cd ..
stef@medusa:/tmp$ mkdir foo.git
stef@medusa:/tmp$ cd foo.git/
stef@medusa:/tmp/foo.git$ git init
Dépôt Git vide initialisé dans /tmp/foo.git/.git/
stef@medusa:/tmp/foo.git$ touch hello
stef@medusa:/tmp/foo.git$ git add hello
stef@medusa:/tmp/foo.git$ git commit -m'hop'
[master (commit racine) 6b0a7b9] hop
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello
stef@medusa:/tmp/foo.git$ git push stef@medusa:/tmp/plop.git master
Enter passphrase for key '/home/stef/.ssh/id_rsa':
Décompte des objets: 3, fait.
Écriture des objets: 100% (3/3), 206 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'.
To medusa:/tmp/plop.git
! [remote rejected] master -> master (branch is currently checked out)
error: impossible de pousser des références vers 'stef@medusa:/tmp/plop.git'
stef@medusa:/tmp/foo.git$
C’est il me semble le comportement par défaut de ne pas le permettre.
[^] # Re: git != svn
Posté par Marotte ⛧ . En réponse au journal Git : les bases et guide d'utilisation en mode centralisé (à la SVN). Évalué à 3.
C’est il me semble le comportement par défaut de ne pas le permettre.