Reputation: 8119
Having just cloned this, the directory immediately has changes in it?
I have never encountered something like this and I am curious why this is happening? and how this is even possible?
UPDATE:
I cloned the repo using git clone git://github.com/horndude77/open-scores.git
and imediately after running git status reveals:
git status
# Not currently on any branch.
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: SaintSaensRomanceOp36/defs.ily
# modified: SaintSaensRomanceOp36/horn.ily
#
no changes added to commit (use "git add" and/or "git commit -a")
git diff reveals:
warning: CRLF will be replaced by LF in SaintSaensRomanceOp36/defs.ily.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in SaintSaensRomanceOp36/horn.ily.
The file will have its original line endings in your working directory.
diff --git a/SaintSaensRomanceOp36/defs.ily b/SaintSaensRomanceOp36/defs.ily
index 07e09ac..c7961be 100644
--- a/SaintSaensRomanceOp36/defs.ily
+++ b/SaintSaensRomanceOp36/defs.ily
@@ -1,47 +1,47 @@
-\version "2.13.13"
.
.
.
NOTE: only the top of the diff is included as it was very long.
Is it removing the CRLF characters when I clone the repository and if so how were these ever included in a commit to bigin with?
Upvotes: 4
Views: 3600
Reputation: 1
None of the previous answers were right for my situation.
For me, this error was caused by file name case sensitivity on Windows.
This situation most likely pertains to some GitBook users, syncing GitBook to GitHub and then GitHub to Windows. It seems to be a bug in GitBook, specifically caused by a) having GitBook's sample content, then b) creating a new first page on your site, and c) moving the sample content to beneath your new first page. (I also hid the sample content.) It appears that this sequence of actions results in two readme.md files existing, one called README.md
and one called readme.md
.
If you're using Windows (or other OS if your file system is case-insensitive):
README.md
and readme.md
.Screenshot of duplicated files on GitHub website but not on Windows
Go back to GitBook and delete the original sample "welcome" page, as this is probably responsible for the error.
You may need to to uninstall github sync from your gitbook space. Then set it up again. I managed to use the same configuration as previously, although there was an error that got resolved by refreshing the webpage.
Wait for GitHub Sync to sync again. The duplicate file should be gone.
If not, then try the next steps.
Go back to yout GitHub repo. If both files are still there, and one of the files is unwanted, just delete it from the GitHub website. If you need both then you're gonna have to deal with it however you wish -- rename one file, or copy the contents all into one, whatever.
Delete the repo folder from your computer and then clone it from the web again.
Hopefully, success 👍
I synced my new GitBook site to GitHub after making a few edits to the page structure and creating a new first page.
Then I cloned the repo to my computer -- Windows.
Immediately after cloning, the GitHub desktop app showed me a diff of the readme file's changes. There was no possible way that it could have already had changes.
I deleted the repo folder from my github folder and cloned it again. Several times: same result every time.
I looked at the repo in the web interface and found two readme files:
But in the synced folder on Windows, it showed only one file, readme.md.
I checked which file I wanted and deleted the other one.
Then deleted the repo folder off my computer and cloned the repo again (because fetching origin again didn't fix the local issue).
(I don't understand how this error can even come to exist. Surely the developers at GitBook know that Windows's file system is case-insensitive?)
Upvotes: 0
Reputation: 8119
The CRLF characters included when the commit was made on a windows machine are automatically removed when the repository is cloned. Git then detects this change and hence the repository is modified right after cloning with the user having done anything other than a git clone
.
I fixed this by removing * text=auto
from my .gitattributes
file.
Upvotes: 5