I am running a Virtual Box Ubuntu VM where I set up my git repository. I then used Samba to create a shared folder and based on another answer (Git not working with Ubuntu → Windows Samba shared directory) I updated my git windows version to 2.16.1 (matches my Ubuntu git version)
I call git status on my Ubuntu VM and find that I'm on branch "master" and I am up to date
I switch to my local machine and on my MINGW64 terminal call git status and after a long delay, a long list of uncommitted changes show up largely "typechange" but some files that are marked as "modified" or "deleted
I switch back to my VM and call git status and after a long delay, I'm told that I'm still on master and am up to date. Calling git status another time the delay goes away
What's going on here and how do I fix it? I already tried git config core.autocrlf true and git config core.filemode false, closed out and re-opened by git terminal and the same issue didn't go away.
Related
I work on Windows 10 with WSL2. I initialized a git repo in git bash (Windows) and everything works fine (commit, push etc.).
git status # on Windows, git bash
When I switch to WSL2 and have a look at the same status of the same repo (drive mounted in WSL), I find that all files are untracked (WSL2 bash).
git status # same repo in WSL2 bash
My Questions:
Why does this happen?
Is there a way to avoid this and achieve consistency across both OS (i.e. without cloning into a separate repo in WSL)?
you might find some answers here
TLDR : git config --global core.autocrlf true
Suppose I create a branch with a legal name "prn" on a Mac
git checkout prn
I make some changes, commit and push. No problem. Someone else on my team who uses Windows pulls this same repository encounters the error:
cannot lock ref 'refs/remotes/origin/prn' prn .... -> origin/prn (unable to update local ref)
Most posts on this error recommend
git gc --prune=now
git remote prune origin
However, this did not solve the error.
Windows has a list of reserved namespaces that preclude git from creating the file "prn" at ./.git/refs/remotes/origin. To solve this, our team deleted the branch from the Mac computer:
git branch -d prn
git push -d origin prn
We then cleaned up references to this branch on both computers (Mac and Windows)
git gc --prune=now
git remote prune origin
The last line will throw an error on the Windows machine stating that branch doesn't exist, which is fine. We were able to pull on the Windows side no problem after this.
I installed Ubuntu subsystem on my Windows 10. Everything was fine until I went to see my local git repository for changes, after git checkout my entire project was marked modified. This is my output of git diff.
you might have to set the line-ending for Git (on Linux) to Windows (or keep them "native", as checked out)... when overwriting Windows line-endings with Linux line-endings, the result looks about like this. just revert and then configure Git before checking out again:
git config --global core.autocrlf input
one can also define all of that (even for specific file-types) with a .gitattributes file.
alternatively, commit those line-endings to the local repo and then use a text-editor, which does support them... meanwhile even the infamous Notepad has received an update, to be able to do that (most editors come with a small line-feeds/text-encoding indicator, to the bottom-right). also see dealing with line-endings (in case autocrlf should not work as excepted).
I've recently installed a vagrant VM on my windows box running ubuntu 14.04 for development purposes. I moved an existing Git project and placed this in the (synced) /vagrant folder so that I can get to my code from windows.
When I wanted to do my first commit, I saw that all files were modified. After googling for a bit I saw that this can be solved using:
git config core.filemode false
This made most of the changed files disappear, however some are still changed. After checking these files it seems that there's somehow a different line ending.
To solve it, I first tried:
git checkout .
But this had no effect whatsoever so I started searching again and found:
git config core.autocrlf true|false|input
git config core.eol lf
I tried each of these combinations followed by a git checkout . and git status but it keeps saying that my files are modified.
Does anyone of you know a solution to this (quite annoying) issue?
I am running ubuntu 12 VM using virtual box on my mac. I have cloned a git repo in a shared folder on my mac. From that folder, in my ubuntu VM, i am creating a intellij project. Trouble is, when i create that project it marks all the files as changed with no change in contents(possibly due to different line ending). How can this be avoided? I have this configuration in .gitconfig on my mac and ubuntu vm autocrlf = input.
Can someone suggest the solution?
Check that you are using git on host machine and then try to set core.autocrlf to false:
git config --global core.autocrlf false
Reset all 'changes' to head with:
git reset --hard HEAD
Also check that your git has disabled handling for filemode changes
git config --list
Should be
core.filemode=false
If not, then set it with:
git config --global core.filemode false
The easiest was is to desactive that setting:
git config --auto auto.crlf false
(on your mac)
If your IDE (here IntelliJ) doesn't change the line endings, there is no need to impose a global settings changing all the files.
If some files have to keep a specific line ending, use core.eol directive in a .gitattributes file (which isn't a local config, but a file part of your repo, and as such, pushed and pulled as the other files).
See "How line ending conversions work with git core.autocrlf between different operating systems".