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).
Related
I'm trying to deploy the latest scrapinghub/splash
I am using git-bash on win10. I forked the repo to https://github.com/kc1/splash/blob/master
I've run into some problems in my original question (Docker: /bin/sh: 1: /tmp/provision.sh: not found)
Its been suggested that the problem is that the shell scripts have windows line endings (crlf) instead of the unix type (lf). I checked and indeed windows ending are being used in my cloned repo locally.
How can I clone the repo so that I get the unix type endings in my local windows environment?
git clone --config core.eol=lf <repository>
Basically, you want to set this config param to control the line endings on your machine. The default of native will use whatever is native on your machine (which is crlf on windows). You can also set this in you global configs before doing the clone if you want it to apply to every repo
git config --global core.eol lf
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 have been having line endings issues on bash scripts for several months. I have another, slightly older Macbook Pro which can run the same scripts without issue.
This has been happening for numerous scripts with different contents written by different people, in different folders. It has affected every script I have attempted to run for the past three months. They have come from Github repos that contain mostly Drupal projects that I've collaborated on with a variety of other developers, none of whom experienced this problem and who were unable to reproduce it with their versions of the scripts. I did not download them as zipped files. I always clone them. They are private repos that I can't link here.
I thought maybe it was related to my .bash_profile settings so I tried changing them to match those of my other machine, which didn't have any effect. I then tried removing all .bash_profile and .bashrc files completely (after backing them up). Again, no effect.
This question is not about how to change line endings, which is covered in similar questions. It is about how to figure out why all the line endings on scripts on my machine are different to those on my other machine and all my coworkers' machines.
This is a systemic problem affecting my whole computer and I'm looking for a a solution more permanent than editing an individual script. The bash version is GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12).
Quick summary: You have core.autocrlf = true in your git configuration.
I've created a small public repo that you should be able to use to reproduce the problem:
git clone git#github.com:Keith-S-Thompson/hello.bash.git
This repo contains a 2-line shell script that should simply print hello on standard output. I expect that when you try it, it will print
bash: ./hello.bash: /bin/bash^M: bad interpreter: No such file or directory
on stderr.
I ran the following command to produce this symptom:
git config --local --add core.autocrlf true
I used --local so it would affect only my local copy of this repo, but you probably have something like:
[core]
autocrlf = true
in your $HOME/.gitconfig file (or it might be some related option).
You can also use
git config --list
to list your current configuration, including both local and global settings.
Remove the autocrlf = true line. (You can also update your configuration using the git config command; run git config --help for details.) Once you've verified that it fixes the problem for the hello.bash repo, re-clone your other repos.
Change the new line char. On a normal *nix box you fix this with dos2unix but, according to Google, on osx you need to do:
cat scriptname | col -b > scriptname2
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".
I'm running the official windows binary of emacs 24.1.1 with magit. When I commit a file, the username and email shown on the log are ripped from my account and machine name, rather than using the values set in either the global git config or the local settings for this repro.
From git bash and dos, I can ask git for user.email and user.name and get the local repro settings.
magit and vc-git's diff mode also seems to be ignoring my autocrlf settings, so this may be an emacs-wide problem, not specific to magit.
C:\Program Files (x86)\Git\cmd is is on emac's exec-path.
How can I either instruct magit to find the correct settings, or tell it manually what the settings are?
You might want to control that your $HOME is the same from Emacs point of view, and from your shell point of view. Chances are that they're not the same, hence $HOME/.gitconfig is not found in Emacs.
you can add a HOME enviroment varibales and specify the dir the same with the .gitconfig dir.