开发者

What does "warning: unable to unlink website: Operation not permitted" mean when checking out a Git branch?

I'm trying to create a local branch that tracks a remote branch. Here's what I get:

> git checkout master

> git push origin origin:refs/heads/myBranch
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:myrepo/myproject.git
* [new branch]      origin/HEAD -> myBranch

> git fetch origin

> git checkout --track -b myBranch origin/myBranch
warning: unable to unlink website: Operation not permitted
Branch myBranch set up to track remote branch myBranch from origin.
Switched to a new branch 'myBranch'

What does "warning: unable to unlink websit开发者_运维知识库e: Operation not permitted" mean? Did everything work fine?

Later:

There is a folder called "website," but it has no contents. git submodule init and git submodule update both do nothing, and git submodule init website and git submodule update website both yield

error: pathspec 'website' did not match any file(s) known to git.
Did you forget to 'git add'?


git issues that warning when you're switching from a branch that has this submodule to one that does not.

When switching branches, git wants to clean up your working copy from everything that doesn't belong, but it can't delete directories which have submodules in them because they are designed to be completely manual — git never implicitly touches the state of your submodules.


It should means that you:

  • have (for instance) a submodule defined in it
  • are potentially using a recent Git (1.6.4 or more)
  • are using it in a Cygwin session (in which case you can try, as in this thread, a:

    strace -o /c/temp/cygwin17.bug --mask=all git checkout --track -b myBranch origin/myBranch

to see if the error log can tell you more.

(see this thread)

I've noticed that git-1.6.4.2 in Cygwin-1.7 exhibits some unusual behaviour and although I don't know if it's a Cygwin issue.
I really don't have a way to check, so I'll simply report it here.

I've compared this behaviour with git-1.6.1.2 from Cygwin-1.5, and it does not occur, so it's new behaviour in git-1.6.4.2.

The problem concerns sub-modules.
With git-1.6.1.2, when using 'git checkout' to move away from a branch that has a submodule ("build") associated to a branch that does not have that submodule associated, I get the following warning message:

$ git checkout -f master
warning: unable to unlink build: Operati

on not permitted

The concerned directory remains undeleted. I note with the older git that it also doesn't remove the directory, but no warning is displayed.

But what is concerning is that a subsequent 'git clean -fdx' does not remove the submodule directory either. With git-1.6.1.2 the directory would be deleted by:

$ git clean -fdx

But with 1.6.4.2 it instead says:

$ git clean -fdx
Removing build
$ ls -l
...
drwxr-x---+ 1 dantliff Domain Users 0 2009-11-23 17:01 build

The 'build' directory is untracked so 'git clean -d' should remove it, but it doesn't.

(At this point, you can try a 'git reset --hard myBranch' if you are on myBranch branch, to try and see if any extra directory is removed, as mentioned in this thread)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜