I am uisng sourcetree 1.8.3.0 on Win10. I have created a GIT repository on a local NAS as a file set. Then clone this to local workspace on my C drive. Update the content on local repsository C drive ... commit .... then push back to the repository on ther NAS. I get the following error ...
"git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
Pushing to O:\GIT\GV-TDMA\PSU-IO Board\EaglePCB
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."
If I do the same process but using Bitbucket to host the remote repository it all works OK ....
Whats wrong .... ????
Any help appreciated
Your NAS isn't really setup as a real git server.
To get rid of this error go to the folder on the NAS and run this command in terminal:
git config receive.denyCurrentBranch ignore
Now you can push to the file server without seeing that message.
It is best to have the repo on the NAS as a "bare" repo.
(http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/)
If you don't you'll have this other annoying problem if you open your NAS repo in SourceTree:
The “old” files on the server will be seen as “different” from the “latest” commit that you pushed to it. So it will think the “old” files are “new changes” that need to be commiteed. But they aren’t.
So what you have to then do is double click the latest commit in the history view and select discard changes. (remember the changes aren’t actually changes, they are the old files which are different because they are old.)
Doing that will make the contents of the folder match the latest branch with the exception of any files that were deleted in the latest commit. Those files will remain and will show up as untracked. Just delete them manually.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.