1

Текст ошибки:

$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 262 bytes | 131.00 KiB/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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To D:/Programming/Source/Java/./t1/.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to [здесь указан путь к origin]

git pull выполнял, git status выдает, что все нормально:

$ 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 tree clean

Сами репозитории находятся в соседних папках, если что.

3
  • Каким образом был получен локальный репозиторий ? Не является ли он bare-репозиторием (githowto.com/ru/bare_repositories) ?
    – user177220
    7 янв 2019 в 18:19
  • Судя по сообщению, вы клонировали не bare репозиторий, а рабочую копию. Вы просто ошиблись или это было сделано нарочно?
    – Alexey Ten
    7 янв 2019 в 19:27
  • 1

2 ответа 2

1

Ответ был дан в комментариях. Клонированный репозиторий был не bare.

0
0

Вольный перевод сообщения об ошибке: "По умолчанию запрещен push в текущую ветку не-bare репозитория. Если очень надо - читайте про настройку receive.denyCurrentBranch, но этот метод не рекомендуется."

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.