Skip to content

error.GitError: --force-sync not enabled; cannot overwrite a local work tree. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DKLind opened this issue Feb 10, 2017 · 1 comment

Comments

@DKLind
Copy link

DKLind commented Feb 10, 2017

Following 'repo init', all repositories have detached heads.
I'm getting this error when ever I checkout a remote branch from a repository, followed by 'repo sync'.
I have git version 2.11.1.windows.1 installed.

eddyp pushed a commit to eddyp/git-repo that referenced this issue Feb 17, 2017
Git and other clients such as SourceTree will rewrite .git/config
in the modules when checking out a branch tracking a remote branch.
The rewrite appears to be a remove then recreate operation, which
efectively removes the .git/config symlink.

As a consequence, repo sync will complain in project._CheckDirReference()
will detect the src and dst for 'config' to be different and assume there
are local changes which need not be overwritten/lost.

As a workaround, from the sync context we skip the check on the config file
to be correctly linked.

This is probabaly NOT the Right Way(TM) to fix this, but is enough to
allow the sync to work in a way which does not seem to be catastrophic
or obviously broken.

Probably the correct solution would be to remove the .repo config and
replace and re-symlink it with the one in the module itself.

Signed-off-by: Eddy Petrișor <[email protected]>
@eddyp
Copy link

eddyp commented Feb 17, 2017

@DKLind Can you check that with the fix in #58 things are OK for you?

I am almost 100% mine is not the right fix, but in my case it worked around the issue decently enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants