I'm new to Sourcetree, so bear with me. I set up a repository on my desktop computer in the office for my department to use to share files. The repository is located here: //ANNALISA_DESKTO/Users/Box Works/Documents/Electrical Department
I have cloned the repository on my laptop and a co-workers laptop. My clone is located here: C:\Users\boxworks\Documents\Electrical Department
I can make changes to the repository on my desktop and pull them onto my laptop, but I cannot make changes on my laptop and push to the repository. I get an error:
"git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master Pushing to //ANNALISA_DESKTO/Users/Box Works/Documents/Electrical Department
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 //ANNALISA_DESKTO/Users/Box Works/Documents/Electrical Department ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to '//ANNALISA_DESKTO/Users/Box Works/Documents/Electrical Department' "
So I'm gathering that I'm supposed to be operating on my desktop from a clone instead of the actual repository? I'm not sure if I'm on the right page here. Can anyone offer some insight?
This error is showing up because you didn't create the original repo as a bare repository, thus it's "protected" in a way you can't just push to it.
You can do as the error message says and set receive.denyCurrentBranch in the server side, where this repository is originally located. You can do this by navigating to the repository in the original location and running:
git config receive.denyCurrentBranch ignore
For reference, I took this from http://stackoverflow.com/questions/3221859/cannot-push-into-git-repository
I would recommend having two repositories on your computer. First, create a bare repository (I'll call it the "central repo"); your team members should use the central repo as their remote. Second, create a local (non-bare) clone of the bare repository for your own work (i'll call it your "working repo"). Your working repo will be able to push and pull to/from the central repo as a remote repo, even though it is on the same machine.
I deleted my repositories and started over. When I try to create a bare repository in the command line in my desired directory, I typed in "git init --bare PATH". But I get an error saying "git is not recognized as an internal or external command." What am I doing wrong???
Hi Annalisa, This is basically a message that tells you Git isn't installed or isn't properly set in your path, thus it can't be found in the command line. You may refer to http://stackoverflow.com/questions/4492979/git-is-not-recognized-as-an-internal-or-external-command for further help to set this.
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs