Я клонировал удаленный репозиторий и сделал несколько коммитов.Я пытаюсь отправить свои коммиты обратно в репозиторий, чтобы другие разработчики могли получить их.Сначала я попытался: git push "other_serv" my_branch:master
, но я получил
remote: error: refusing to update checked out branch: refs/heads/master[K
remote: error: By default, updating the current branch in a non-bare repository[K
remote: error: is denied, because it will make the index and work tree inconsistent[K
remote: error: with what you pushed, and will require 'git reset --hard' to match[K
remote: error: the work tree to HEAD.[K
remote: error: [K
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to[K
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into[K
remote: error: its current branch; however, this is not recommended unless you[K
remote: error: arranged to update its work tree to match what you pushed in some[K
remote: error: other way.[K
remote: error: [K
remote: error: To squelch this message and still keep the default behaviour, set[K
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.[K
To user@server:/path/to/git
! [remote rejected] my_branch -> master (branch is currently checked out)
Так что я погуглил проблему и на удаленном сервере попытался:
git checkout -b dummy
Затем попытался нажать еще раз, но получил ту же ошибку,Поэтому вместо того, чтобы толкать мастера, я пытался толкать манекена.Затем я получил эту ошибку:
error: Unable to append to ./logs/refs/heads/dummy: Permission denied
To user@server:/path/to/git
! [remote rejected] my_branch -> dummy (failed to write)
error: failed to push some refs to 'user@server:/path/to/git'
Так что я искал больше и обнаружил, что у некоторых людей были проблемы с их разрешениями.Поэтому я выполнил chmod'd и chown'd все файлы:
-rw-rw-r-- 1 user git 41 2011-06-20 20:07 dummy
-rw-rw-r-- 1 user git 41 2011-06-19 19:47 master
, и я могу писать как на dummy, так и на master, но я все равно получаю сообщение об ошибке выше.У кого-нибудь есть какие-то решения?Я бился головой об этой, предположительно простой проблеме.
РЕДАКТИРОВАТЬ : Похоже, что нашел основную причину.По какой-то причине мой репозиторий находится в /path/to/repo.git, хотя все команды, которые я использую, указывают на / path / to / repo.Это часть git?
РЕДАКТИРОВАТЬ 2: Оказывается, там была вторая папка с именем ./repo.git.Поскольку папка ./repo была пуста, git искал файлы ./repo.git, а не ./repo.Кажется, что при поиске ./.git, git предпочитает ./repo.git/.git, а не ./repo, когда файлы конфигурации git находятся внутри ./repo