5

Imagine the following scenario:

Manager has created a team project and decided to use (latest) git as VCS for the project. Developer team will be working using (latest) VS2015 (Enterprise) IDE. Manager has created a new (origin) branch called "master" and then committed & pushed 2 files to that branch.

Project file hierarchy:

  Project (Root) Folder
    | notes.txt
    \ readme.md

Developer team made of "Jym" and "Bennie" has pulled origin/master branch (and both of them are working on local/master branch). Jym has committed & pushed the first change to "notes.txt" file (directly to master branch). Bennie has created a new file called "todos.txt", and also was making some changes to "notes.txt" file. Now when Bennie tries to sync/pull changes (that were made earlier by Jym), the following message is displayed in Synchronization window:

Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details.

To make things a whole lot worse for the team, Bennie is also experiencing the exact same issue that was opened in late December last year. This means that Bennie is practically unable to run any git command (however, all features but "undo" seems to work fine with Visual Studio Git/TFS providers - which he have found really weird).
Also because of that, this question is not (possible) duplicate of another question.

How to solve the issue (from scenario described above) that Bennie is experiencing (using only Visual Studio of course)?

If there are any more details I can provide, please just post a comment.

EDIT 1 (output from suggested answer for solving "null" device):
Results from the first step: Isn't that a typo in that answer, shouldn't "nul" be "nil"?
See screenshot

Results from the second step (Device Manager): With View -> "Show hidden devices" option checked, there are no devices with small "warning" icon (unknown/unrecognized device) or "null" in any of devices' names.
Also, apparently "Non-Plug and Play Drivers" type is not even being listed (of course when View -> "Devices by type" is selected).

Results from the third step: %SystemRoot%\system32\drivers\null.sys file had existed and was deleted from the disk (copied and pasted in null.sys file from Windows 10).
More details: Once right-clicked any of those sys files, there is no "Install" nor "Uninstall" option in context menu, default action seems to be "Open with..." (which is bolded).

Results from fourth step: Attempt to merge null.reg failed. Reassigned owner of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root registry key, also set up appropriate permissions.
null.reg file was successfully merged into registry after updating registry key permissions.
Restarting a computer.
Waiting for the final answer ... Error still on show!
See screenshot

EDIT 2 (testing PATH environment variable):
See screenshot Same error still occurs (even after opening git-cmd.exe or git-bash.exe as administrator).

EDIT 3 (power options, not using "Allow the Computer to Enter Away Mode" setting):
Reference thread.
See screenshot

EDIT 4:
After Bennie has upgraded his machine from Windows 8.1 to 10, issue has been solved. We can now simply conclude that operating system was corrupted.

Community
  • 1
  • 1
OmegaExtern
  • 856
  • 2
  • 7
  • 15
  • could you please provide extra details on whether Bennie has committed his (her?) changes ? – Andrey Pesoshin Jan 31 '16 at 09:32
  • @AndreyPesoshin Bennie get "Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details." So he made changes locally one commit behind origin/master and unable to use git (or undo feature - for unknown reason). He tried reinstalling Git, Git for Windows (GitHub client), verifying that Git directory is set in PATH environment variable, etc. but git always responds with such/similar error message: "fatal: open /dev/null or dup failed: No such file or directory". He also tried using SourceTree, Tortoise... Nothing worked. – OmegaExtern Jan 31 '16 at 09:39
  • I mean Bennie can get the same error in case the changes are REALLY UNCOMMITTED and seen via `git status` as pending changes. So as far as I understood, the changes ARE committed into master just before the `git pull` command is tried to be executed? – Andrey Pesoshin Jan 31 '16 at 09:55
  • @AndreyPesoshin Yes, of course there are uncommitted changes. No, the changes Bennie made locally are not committed nor pushed (he is stuck with his changes, 1 commit behind compared to origin/master). And Visual Studio has started to bug him now too, like if he creates a new file, it is not being tracked (added to included changes, same applies if he tries to permanently remove a file, like he's totally out-of-sync). – OmegaExtern Jan 31 '16 at 10:07
  • I've read your question once again with comment on details provided. Git normally wants changes to be first committed and only then synchronized with remote repositories. So if Bennie has a proper installation of git for Windows and/or VS2015, so he will be able to commit changes and then to pull and push (in this order) local state from and into the remote repository. If not - Bennie has to reinstall IDE and tools. Could you please try and return with the answer? – Andrey Pesoshin Jan 31 '16 at 11:55
  • @AndreyPesoshin My team is open for solving this whatever it takes. Reinstalling OS is not an option. Core issue here is, "null" device. That I have just got a report about. See comments in VoC's answer. I will update Q with more details and a report about "null" device in a moment. – OmegaExtern Jan 31 '16 at 12:11
  • I'm talking about reinstalling Git for Windows (msysgit), not OS. Maybe there are screenshots or log information from git-cmd/msysgit to be added to the topic question? – Andrey Pesoshin Jan 31 '16 at 12:17
  • @AndreyPesoshin I have updated Q. Added more information, outputs from each step (based on link that was added by VonC). Still not solved. – OmegaExtern Jan 31 '16 at 13:06
  • It seems like you have two very distinct issues here and this should be two separate questions. What version of VS 2015 are you running? Does this behavior change if you upgrade to the latest Quaterly Update? – Edward Thomson Jan 31 '16 at 14:07
  • @EdwardThomson Manager said it in the very beginning of the scenario. "Developer team will be working using (latest) VS2015 (Enterprise) IDE." Which is VS2015.1 (Update 1) with all necessary tools installed (3rd party Git extension, also installed msysgit, workspaces are configured, everything works fine in VS) and everything is up-to-date as of today. Just read it twice before posting comment, please? Because, I end up copy+pasting information I have already provided a few times that is already stated in the question (do 2+2). – OmegaExtern Jan 31 '16 at 14:27
  • Great! I see my advice to upgrade was a good one \o/ – VonC Feb 01 '16 at 18:47
  • @VonC @OmegaExtern so, as we can see here, the ```Reinstalling OS is not an option``` was a false statement :) – Andrey Pesoshin Feb 04 '16 at 20:38
  • 1
    @AndreyPesoshin Upgrade was the latest suitable option; reinstall (format/clean install) was not. There is a difference between the two ;) – OmegaExtern Feb 05 '16 at 19:46

1 Answers1

13

Whenever a GUI (here a VS with Git integration) steps out of the nominal path (here a git push not immediately possible), revert to the git command line interface.

In your case, Bernie needs to a a git pull --rebase.

Open a git bash, and do (as Bernie)

cd /path/to/repo
git status # make sure everything is committed
git pull --rebase
git status # you see notes.txt as being in conflict
# edit notes.txt and resolve the conflict by removing merge markers
git add .
git rebase --continue

git push

Note, git pull --rebase might come soon to Got for Visual Studio (follow @gitforvs):

g4vs

Nothing official yet though.


Regarding "Couldn't open /dev/null (or dup failed)", see if "Getting errors when using GitHub for Windows" could help (issue with the null device).

IF the error persists though, as in git-for-windows/git issue 583, re-installing Windows remains the surest way to get out of this predicament.

As mentioned by the OP OmegaExtern in Edit 4, upgrading from win8 to win10 was enough to restore the device and solve the issue.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This can't work out because "This means that Bennie is practically unable to run any git command". Read question once more? – OmegaExtern Jan 31 '16 at 09:42
  • @OmegaExtern I have read it, and I am sure Bernie can run git commands in a shell. Just unzip https://github.com/git-for-windows/git/releases/download/v2.7.0.windows.1/PortableGit-2.7.0-64-bit.7z.exe anywhere Bernie wants. – VonC Jan 31 '16 at 09:47
  • Bennie runs Windows 8.1 (x86/32 bit). I have sent him 32bit portable zipped Git, and he then corrected environment variables (gitdir and path accordingly as mentioned in readme). When he runs git-bash executable as administrator, it shows command prompt and then it closes and there is a new file created called "mintty.exe.stackdump", here is contents of the file: https://gist.github.com/anonymous/3ac9bcdf699d2a6b5f3c#file-mintty-exe-stackdump – OmegaExtern Jan 31 '16 at 10:18
  • @OmegaExtern no need for git bash, the git-cmd.exe is enough. That will open a regular CMD session, which should work just fine. – VonC Jan 31 '16 at 10:18
  • Ok, now he opened git-cmd.exe (as administrator). Well, same error message again: "fatal: open /dev/null or dup failed: No such file or directory". – OmegaExtern Jan 31 '16 at 10:21
  • @OmegaExtern is the error message visible when the window opens, or in response of a git command (and if so, which one?)? – VonC Jan 31 '16 at 10:22
  • It is in response to git command. Just typed "git" and hit return key, after that it responded with error message stated above. – OmegaExtern Jan 31 '16 at 10:24
  • @OmegaExtern what about `cd c:\path\to\repo` and `git status`? – VonC Jan 31 '16 at 10:25
  • @VoC Of course, batch commands and everything else works just fine. Personally I think this is something to do with the new update that was released lately in 2015, after he updated Git and GitHub, they just stopped working. Any git command fails with the error message, as I already said a few times. – OmegaExtern Jan 31 '16 at 10:27
  • @OmegaExtern the next thing to test is to open a regular CMD, and type `set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\path\to\PortableGit-2.7.0-32-bit\bin`, and see if the issue persists with that *simplified* and *minimal* PATH. – VonC Jan 31 '16 at 13:38
  • @OmegaExtern in a git bash, can you try (as in https://github.com/progrium/busybox/issues/2#issue-36407815) `touch /dev/null` then `git` again? – VonC Jan 31 '16 at 14:22
  • You have forgot one thing (read my second comment on your answer). When Bennie runs git-bash.exe (as admin), program/black window closes down almost instantaneously and a new file is written in root directory of portable git, that is next to git-bash.exe (called "mintty.exe.stackdump"): https://gist.github.com/anonymous/3ac9bcdf699d2a6b5f3c#file-mintty-exe-stackdump – OmegaExtern Jan 31 '16 at 14:41
  • @OmegaExtern And does it close as well when calling git-bash.exe from the CMD with the simplified path? – VonC Jan 31 '16 at 14:42
  • @OmegaExtern if it does... https://github.com/git-for-windows/git/issues/583#issuecomment-168316692, unfortunately. – VonC Jan 31 '16 at 14:44
  • C:\Users\User\Downloads\PortableGit>git-bash.exe, opens a window for about 2 seconds later it closes, so yes in whatever case it closes/crashes. Reinstalling OS is not an option. – OmegaExtern Jan 31 '16 at 14:45
  • @OmegaExtern Would it be an 'Away mode' issue? (https://social.technet.microsoft.com/Forums/windows/en-US/9b5cd375-ed22-4e31-baf8-f714a3d60303/null-device-does-not-start?forum=w7itproinstall) – VonC Jan 31 '16 at 14:57
  • Updated Q (see edit #3). It is already set to other setting than "Allow the Computer to Enter Away Mode". – OmegaExtern Jan 31 '16 at 16:33
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/102154/discussion-between-omegaextern-and-vonc). – OmegaExtern Jan 31 '16 at 16:37