Git basics - git push origin master not working correctly

I’ve done everything like in the video, however when I type in the command line git push origin master, I get this output:

Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 283 bytes | 283.00 KiB/s, done.
Total 3 (delta 1), 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 /home/alan/Desktop/Odin/GitTutorial/ClonedRepo/…/RemoteRepo.git/
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to ‘/home/alan/Desktop/Odin/GitTutorial/ClonedRepo/…/RemoteRepo.git/’

Anyone willing to help? I searched on google and it said something about bare and non-bare directories, but I don’t know what any of that means.

Hey @rejnowicz281, I have encountered the same problem. Did you solve it?

Yeah, I just started making my repositories through github instead of the command line and it started working fine. Hope it works for you

1 Like

Oh, ok thanks. Seems like the method used inn the video doesn’t work on newer versions