“执行 git init 时出现错误”

huangapple go评论66阅读模式
英文:

GIT - Errors when executing git init

问题

在使用GitBash在Windows虚拟机中执行git init时,一个开发者遇到了以下错误:

  1. 第一次出现

     错误:无法写入配置文件//xxx/yyy/.git/config:功能未实现
     致命错误:无法将'core.symlinks'设置为false
    
  2. 第二次出现

     错误:无法写入配置文件//xxx/yyy/.git/config:功能未实现
     致命错误:无法将'core.repositoryformatversion'设置为'0'
    

然而,另一个在同一虚拟机中的开发者没有遇到问题。
他能够执行git initgit addgit commitgit push

如果您遇到了相同的问题并找到了解决方案,请提供帮助。

英文:

When executing git init in GitBash, in a Windows VM, one developer had the following errors:

  1. 1st instance

     error: could not write config file //xxx/yyy/.git/config: Function not implemented
     Fatal: could not set 'core.symlinks' to false
    
  2. 2nd instance

     error: could not write config file //xxx/yyy/.git/config: Function not implemented
     Fatal: could not set 'core.repositoryformatversion' to '0'
    

However, another developer in the same VM had no issues.
He is able to execute git init, git add, git commit & git push.

Please help if you had the same issues and discovered the solution.

答案1

得分: 1

这通常是由权限错误引起的。
因此,一个开发者能够使用git,而另一个开发者不能。
请检查您的文件夹(git存储库文件夹)的权限,并验证指定的用户是否能够向该文件夹写入内容(检查指定文件夹及其父文件夹的权限)。

另一个可能性(但不太可能)是防病毒软件正在阻止您更改该文件夹。

英文:

This is usually caused by permission error.

And thus it makes sense that one developer is able to use git while the other one isn't.
Check your folder (git repository folder) permissions and verify that the given user is able to write content to this folder. (check the permissions on the given folder and its parent)

Another option (might be but less likely) is that the antivirus is blocking you from changing the folder

答案2

得分: 0

当在文件夹中创建存储库时:git会在目录的基础处创建一个.git/文件夹,然后操作该文件夹中的文件。

  • 检查是否确实创建了这个文件夹(例如在Shell中键入dir //xxx/yyy/.git),
  • 检查该.git/文件夹的访问权限(在属性窗口的“安全”选项卡中)。
英文:

(to add to @CodeWizard's answer)

When creating a repo in a folder : git creates a .git/ folder at the base of the directory, and then manipulates files in this folder.

  • Check if this folder is indeed created (type dir //xxx/yyy/.git in a shell for example),
  • check the access permissions ("Security" tab of the Properties window) on this .git/ folder.

答案3

得分: 0

当禁用了虚拟机的趋势科技(Trend Micro)时,错误消失了。我不确定为什么在启用趋势科技时,某些文件夹没有出现错误。所以可能需要以不同方式配置趋势科技。

英文:

When Trend Micro was disabled for the VM, the error disappeared. I am not sure why some folders did not have the error when Trend Micro was enabled. So probably Trend Micro had to be configured differently.

huangapple
  • 本文由 发表于 2020年1月3日 20:53:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579002.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定