Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Hadi Farhat](https://secure.gravatar.com/avatar/c22fa45b314414045b89382dcfb71604?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Hadi Farhat
Courses Plus Student 14,136 Pointserror while trying to push
Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 315 bytes | 0 bytes/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: 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 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'. To /Users/hadifarhat/Github/grepo1 ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to '/Users/hadifarhat/Github/grepo1'
2 Answers
![Polina Zapreyeva](https://secure.gravatar.com/avatar/e2538a9ac3cbb0db2eefbeef2862eb2f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Polina Zapreyeva
1,503 PointsI found a way to solve this issue. I went to cloned repository and run: git config --bool core.bare true
After that I went back to origin repository and pushed to cloned repository and it worked.
![Raymond James Cabrera](https://uploads.teamtreehouse.com/production/profile-photos/2545422/micro_Pro.jpg)
Raymond James Cabrera
Courses Plus Student 7,022 PointsYou also have to make sure you're on different branches between the two repositories. Git uses it as a defense mechanism to make sure you don't screw anything up between the two. That's why he went back to the 'master' branch in the original repo.