Не могу выполнить git push. Есть два репозитория repo1 и repo2. repo1 удаленный, repo2 локальный. Настраиваю связь между ними с помощью: git remote add remote-repo1 /f/Denys/test/repo1
. Получаю информацию о репозитории:git fetch remote-repo1
Вывод после команды fetch:
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), 238 bytes | 0 bytes/s, done.
From F:/Denys/test/repo1
* [new branch] master -> remote-repo1/master
После делаю слияние ветки мастер локального репозитория с удаленным: git checkout --track remote-repo1/master
Вывод поле команды checkout: Already on 'master' Branch 'master' set up to track remote branch 'master' from 'remote-repo1'. Далее делаю git pull, получаю сообщение: Already up to date. После команду git log:
commit 91cd7520065a2cb9f57d95c7f4f9067ee804267f (HEAD -> master, remote-repo1/master)
Author: Denys Skotarenko <skotarenkodenis@gmail.com>
Date: Mon Apr 13 07:41:26 2020 +0200
sdgsggs
Потом в repo2 создаю новый файл добавляю его в репозиторий:
touch file.txt
git add file.txt
git commit -m "created file.txt"
[master fe2a825] created file.txt
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file.txt
смотрю, что файл добавлен:
$ git log
commit fe2a8253e7a6deb981e7602cb0485f41d3da7197 (HEAD -> master)
Author: Denys Skotarenko <skotarenkodenis@gmail.com>
Date: Mon Apr 13 08:27:26 2020 +0200
created file.txt
commit 91cd7520065a2cb9f57d95c7f4f9067ee804267f (remote-repo1/master)
Author: Denys Skotarenko <skotarenkodenis@gmail.com>
Date: Mon Apr 13 07:41:26 2020 +0200
sdgsggs
Теперь выполняю git push и получаю сообщение:
$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 277 bytes | 277.00 KiB/s, done.
Total 2 (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 F:/Denys/test/repo1
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'F:/Denys/test/repo1'
Пытался найти ответ в интернете, но так ничего внятного и не нашел. Пробовал создавать заново репозитории, перепроверял настройки, делал мердж (нашел на каком-то форуме), но ничего не помогает. Команда push не отрабатывает, хотя с pull никаких проблем нет. Подскажите, как решить? Если выложил много лишней информации, прошу прощения, учусь с git работаю 3-й день, постарался описать максимально свои выполняемые действия.