Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:51:59+00:00 2026-06-07T05:51:59+00:00

Possible Duplicate: git push error '[remote rejected] master -> master (branch is currently checked

  • 0

Possible Duplicate:
git push error '[remote rejected] master -> master (branch is currently checked out)'

Im trying to push my repository to the “origin”, but I get this error when i run “git push”

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 485 bytes, done.
Total 4 (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: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
Auto packing the repository for optimum performance.
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
/usr/local/git/libexec/git-core/git-sh-setup: Zeile 235: uname: Kommando nicht gefunden.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
To ssh://XXXX@XXXXXX.typo3server.info/html/typo3
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://XXXXXXX@XXXXXX.typo3server.info/html/typo3'

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:52:00+00:00Added an answer on June 7, 2026 at 5:52 am

    You’re trying to push to a non-bare repo (i.e. a repo with a working tree, just like your local clone), but there’s nothing done at the other end to account for this specially.

    You look like you’re trying to let a git push deploy your site. Here’s how to do that:

    1. Ignore the error message git is giving you now by running this in the repo on your server:

      git config receive.denyCurrentBranch ignore
      

      This tells git “I’ll work it out, trust me.”

      Now if you push, it’ll update the repo, but the index and working copy will be left untouched. This means it’ll always look like you’ve staged changes to revert everything you’ve pushed.

      We need a way to update the index and working copy whenever a push occurs. Sounds like it’s time to …

    2. Set up a post-receive hook. Add the file .git/hooks/post-receive on the server’s repository:

      #!/bin/bash
      
      # Drop the env var given to post-receive by default, as it'll mess up our
      # attempts to use git "normally."
      export -n GIT_DIR
      
      # Move back to the base of the working tree.
      cd ..
      
      # *Drop all changes* to index and working tree.
      git reset --hard
      

      Note that this assumes you only ever want your tracked changes live—anything you change directly on the live site will disappear when you next push (excepting untracked files, but you shouldn’t have those either).

    I add a git status at the end so I can see what the lay of the land is after a push (as it gets transmitted back to the client)—this is particularly so I can catch untracked files and either add them to .gitignore, or track them.

    Don’t forget to mark post-receive as executable!


    Aside: why shouldn’t you have untracked files?

    1. Ability to rollback: this is for deploying a live site. If you want to be able to really rollback a failed deployment, then you need everything that went together to make that deployment.

      That definitely includes the core CMS. Right now, it’s only on the server, and it’s untracked, so you’ve got no hope of detecting an error.

    2. Ability to redeploy: if your server’s harddrive goes down, you get to unzip the core CMS, layer your git repo over it again, and hope it works.

    3. Ability to notice what’s accidentally untracked: if you have several dozen untracked files, and they’re all “meant” to be untracked, it’s easy for a new file to sneak in and get lost in the noise.

      If your git status is clean by default, then you’ll notice unexpected untracked files as soon as they pop up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: git push error '[remote rejected] master -> master (branch is currently checked
Possible Duplicate: Git push error '[remote rejected] master -> master (branch is currently checked
Possible Duplicate: What exactly does the "u" do? "git push -u origin master" vs
Possible Duplicate: How git works when two peers push changes to same remote simultaneously
Possible Duplicate: Using Git with an existing Xcode project Setting up a git repository
Possible Duplicate: Local executing hook after a git push? git has a number of
Possible Duplicate: Can I update a forked project, on git, to the original/master copy?
Possible Duplicate: How do you roll back (reset) a git repository to a particular
I currently have a local Git repository, which I push to a Github repository.
Possible Duplicate: Using Git how do I find modified files between local and remote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.