Добрый день,
При создании локального git хранилища, столкнулся со следующей проблемой.
[git@su-git-01 testdir]$ git init
Initialized empty Git repository in /git/testdir/.git/
[git@su-git-01 testdir]$ touch test.txt && echo "HELLO" >> test.txt
[git@su-git-01 testdir]$ git add test.txt
[git@su-git-01 testdir]$ git commit -m "First Init"
[master (root-commit) d6825e1] First Init
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 test.txt
[git@su-git-01 testdir]$
На клиенте делаю следующие шаги:
$ git clone ssh://git@172.24.4.100:/git/testdir
Cloning into 'testdir'...
git@172.24.4.100's password:
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
$ echo "WORL" >> test.txt
$ git commit -m "Second Init"
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: test.txt
no changes added to commit
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
$ git push origin master
git@172.24.4.100's password:
Counting objects: 5, done.
Writing objects: 100% (3/3), 263 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 ssh://git@172.24.4.100:/git/testdir
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://git@172.24.4.100:/git/testdir'
Соответственно, после git reset --hard, ошибка остается прежней.
Впервые столкнулся с git, прошу совета, что я делаю не так?