I am attempting to clone a git repository. The clone fails with the following message:
Untracked working tree file ... would be overwritten by merge.
I have run git clean
on all of the branches; none have untracked files.
The file which is labeled untracked is only used in the branch I am currently working in and it is tracked.
Also, when I checkout the main branch and then checkout the branch I was originally working on, I the checkout succeeds but prints the name of the supposedly untracked file. Any ideas what this means?
Checking out files: 100% (477/477), done.
M path-to-file-idenetified-as-untracked
Switched to branch "Original_branch_name"
How can I get clone to work?
I have read about cloning. I am making a clone because I want to share this with someone else who doesn't currently have the reposoitory.
Here is what I entered, slightly edited. For example, I did several commands to cd, which are not shown.
$ git clone app.git clone/app.git
Initialized empty Git repository in /cygdrive/c/clone/app.git/.git/
error: Untracked working tree file 'C:/app.git/include/template/foo.xml' would be overwritten by merge.
$ git status
# On branch GT
nothing to commit (working directory clean)
$ git rm include/template/foo.xml
rm 'include/template/foo.xml'
$ git commit -m "Removed include/template/foo.xml because clone was failing with the message untracked working tree file would be overwritten by merge "
[GT]: created 77ca4ec: "Removed include/template/foo.xml because clone was failing with the message untracked working tree file would be overwritten by merge "
1 files changed, 0 insertions(+), 89 deletions(-)
delete mode 100755 include/template/foo.xml
$ git clone app.git clone/app.git
Initialized empty Git repository in /cygdrive/c/clone/app.git/.git/
Checking out files: 100% (522/522), done.
$ git commit -m "Added file deleted in previous commit after successfully cloning repository with file deleted"
[GT]: created f3eb7e8: "Added file deleted in previous commit after successfully cloning repository with
file deleted"
1 files changed, 89 insertions(+), 0 deletions(-)
create mode 100755 include/template/foo.xml
$ git clone app.git clone2/app.git
Initialized empty Git repository in /cygdrive/c/clone2/app.git/.git/
error: Untracked working tree file 'C://app.git/include/template/foo.xml' would be overwritten by merge.