Search code examples
gitrepositorygit-pushatlassian-sourcetree

Git - push cannot be executed


I'm not a Git newbie. I downloaded SourceTree for Windows and try to work with Git.

I've created Git repository. Then I cloned this repository. Then I created file in cloned repository and commit it. Now I would like to push changes to the main repository and have a problem with it.

When I select push to origin for master branch in my cloned repository I get the following message:

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 D:\DaneAplikacji\GIT Repos\katalog

 ! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to 'D:\DaneAplikacji\GIT Repos\katalog'

I suppose I'm doing something wrong. How can I push those changes to main repository?


Solution

  • I tried to do the same using TortoiseGit and the effect was the same. After making main repository as bare I can now push changes to this main repository