简体   繁体   English

Visual Studio 2015 的 Git 问题

[英]Git issue with Visual Studio 2015

I have a Visual Studio solution inside a git repository created with TortoiseGit version 1.8.16.0 (git version 2.6.2.windows.1)我在使用 TortoiseGit 版本 1.8.16.0(git 版本 2.6.2.windows.1)创建的 git 存储库中有一个 Visual Studio 解决方案

I just updated Visual Studio from 2015 to 2015 Update 1, and it stopped tracking changes on my files.我刚刚将 Visual Studio 从 2015 更新到 2015 Update 1,它停止跟踪我的文件的更改。 also it won't allow me to commit anything.它也不允许我做任何事情。

Is this some sort of a known problem?这是某种已知问题吗? are there any solutions?有什么解决办法吗?


update更新

(ironic title...) VS tracks unsaved files as "changed" and saved files appear to be "unchanged" (具有讽刺意味的标题...)VS 将未保存的文件跟踪为“已更改”,而已保存的文件似乎是“未更改”

switching branches is behaves correctly and results in an error if there are uncommitted (real )changes切换分支行为正确,如果有未提交的(真实)更改,则会导致错误


update 2更新 2

could this in the output window could have anything to do with the error:输出窗口中的这可能与错误有什么关系:

Opening repositories:打开存储库:

Could not open 'C:/[project path].VC.opendb': The process cannot access the file because it is being used by another process.无法打开“C:/[项目路径].VC.opendb”:该进程无法访问该文件,因为它正被另一个进程使用。

Could not open 'C:/[project path].VC.opendb': The process cannot access the file because it is being used by another process.无法打开“C:/[项目路径].VC.opendb”:该进程无法访问该文件,因为它正被另一个进程使用。

I had the exact same issue as you and spent hours trying to get it to work, including re-cloning. 我和你有完全相同的问题,花了好几个小时试图让它工作,包括重新克隆。

I solved it on my end by adding the *.VC.opendb and *.VC.db files to the .gitignore file of my project. 我通过将* .VC.opendb和* .VC.db文件添加到项目的.gitignore文件中来解决它。

As soon as I returned to Visual Studio all my pending changes were showing. 我一回到Visual Studio,就会显示所有挂起的更改。 As far as I can tell it's all working normally again. 据我所知,它一切正常。

I have same issue with db.lock file ... 我对db.lock文件有同样的问题...

Solution with images are as follow: 图像解决方案如下:

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述

Git will ignore these files for next commit. Git将忽略这些文件以进行下一次提交。

Since the Visual Studio 2015 update 1 release notes and its "Known Issues and Fixed Bugs" page does not mention anything related to Git, try to: 由于Visual Studio 2015更新1发行说明及其“已知问题和修复错误”页面未提及与Git相关的任何内容,请尝试:

  • make a fresh clone of your repo from the command line ( git clone ) 从命令行创建一个新的repo git clonegit clone
  • import the solution in Visual Studio and check if the git repo is detected 在Visual Studio中导入解决方案并检查是否检测到git repo

Or: 要么:

https://regmedia.co.uk/2015/12/01/1.jpg

  • check that you can add new files 检查您是否可以添加新文件
  • close Visual Studio 关闭Visual Studio
  • overwrite that new repo by your own (delete and replace the .git by your own, and copy your worktree over the one used by Visual Studio) 用你自己覆盖新的repo(删除并替换你自己的.git ,并将你的工作树复制到Visual Studio使用的工作树上)

Simpler solution which worked for me (also for VS 2017): open .git\\config file and change 更简单的解决方案适用于我(也适用于VS 2017):打开.git \\ config文件并进行更改

bare: true

to

bare:false

I experienced same issue and I tried several options from search results but they did not work, I had to restart my system and git command worked again...Voila!!!我遇到了同样的问题,我尝试了搜索结果中的几个选项,但它们没有用,我不得不重新启动我的系统并且 git 命令再次工作......瞧!

Maybe you have spent hours coding and system decides to take a rest a little bit seems alot of things are cached, Just restart and get things refreshed again!也许您已经花了几个小时编码并且系统决定休息一下,似乎很多东西都被缓存了,只需重新启动并再次刷新!

To make VS 2015 not show the unmodified files, you need to set core.autocrlf=false in your Git configuration by console. 要使VS 2015不显示未修改的文件,您需要通过控制台在Git配置中设置core.autocrlf=false It sames newer versions of git core includes one new line on file with crlf (VS doesn't show the new line). 同样新版本的git core包含一个带有crlf文件的新行(VS不显示新行)。

To set it through all your repositories write 要通过所有存储库设置它

git config core.autocrlf false

and it will be deactivated. 它将被停用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM