Git on Local Repos!

I use Github and it works fine. But it looks like local repos behave very differently. I created a git repo by ‘cd’ into a folder and ran

git init

I created 2 files, add and commit. Good so far. Then I decided to clone the local repo into another folder.

git clone <folderONe> <folderTwo>

Made some change in folderTwo. Then I wanted to push these changes back to the original folder which was folderOne. So I ran a

git push origin master

Got the following errors:
image
what should I do? All I want to do is push the changes from folderTwo back to the original repo which is in folderOne. This works fine when cloning from repos created on Github but creating repos locally seem to work differently.

I got the answer for this issue. I edited the config file of the real ‘master’ reop, folderOne with the following:

[receive]
denyCurrentBranch = false

Once I did that I was able to go to folderTwo and execute a

push origin master

Got the info from this site:
https://www.wikitechy.com/errors-and-fixes/sql/git-push-error-remote-rejected-master-master-branch-is-currently-checked-out

SOLVED

1 Like

Thank you for posting the solution you’ve found, others will benefit from it.

It’s actually an interesting use case — I never explored this aspect of using Git locally.