Visual Studio 2015 的 Git 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34319008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:38:40  来源:igfitidea点击:

Git issue with Visual Studio 2015

gitvisual-studio-2015tortoisegit

提问by AK_

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. also it won't allow me to commit anything.

我刚刚将 Visual Studio 从 2015 更新到 2015 Update 1,它停止跟踪我的文件的更改。它也不允许我做任何事情。

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”:该进程无法访问该文件,因为它正被另一个进程使用。

回答by Notrace

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 .gitignorefile of my project.

我通过将 *.VC.opendb 和 *.VC.db 文件添加到我的项目的.gitignore文件中解决了这个问题。

As soon as I returned to Visual Studio all my pending changes were showing. As far as I can tell it's all working normally again.

当我回到 Visual Studio 时,所有待处理的更改都显示出来了。据我所知,一切都恢复正常了。

回答by Hassan Rahman

I have same issue with db.lock file ...

我对 db.lock 文件有同样的问题......

Solution with images are as follow:

有图片的解决方法如下:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Git will ignore these files for next commit.

Git 将在下次提交时忽略这些文件。

回答by Guy L.

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

回答by VonC

Since the Visual Studio 2015 update 1 release notesand its "Known Issues and Fixed Bugs" pagedoes not mention anything related to Git, try to:

由于Visual Studio 2015 update 1 发行说明及其“已知问题和已修复错误”页面未提及任何与 Git 相关的内容,请尝试:

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

Or:

或者:

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

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

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

回答by Jose Luis Guerra Infante

To make VS 2015 not show the unmodified files, you need to set core.autocrlf=falsein your Git configuration by console. It sames newer versions of git core includes one new line on file with crlf (VS doesn't show the new line).

要使 VS 2015 不显示未修改的文件,您需要core.autocrlf=false通过控制台在 Git 配置中进行设置。它与较新版本的 git core 相同,在文件中包含一个带有 crlf 的新行(VS 不显示新行)。

To set it through all your repositories write

要通过所有存储库进行设置,请写入

git config core.autocrlf false

and it will be deactivated.

它将被停用。