简体   繁体   English

Git错误:无法提交配置文件

[英]Git error: could not commit config file

I'm trying to add a new remote repository (GitHub) to an existing project, and I'm getting an error that I've never seen before, and don't understand: 我正在尝试向现有项目添加一个新的远程存储库(GitHub),并且我收到一个我以前从未见过的错误,并且不明白:

$ git remote add github git@github.com:me/myrepo.git   
error: could not commit config file .git/config

What? 什么? Why would I commit the git config file? 为什么我要提交git配置文件? And how do I make this stop happening? 我该如何让这种停止发生?

I'm on a Mac, with a relatively fresh install of most of my tools. 我在Mac上,安装了大部分工具。 I think this is the first time I've tried to add a remote to a repo on this machine. 我想这是我第一次尝试在这台机器上添加遥控器到一个回购。

Some git commands modify the git config file. 一些git命令修改git配置文件。 One of them is git remote add , because the remote is stored in the config file. 其中一个是git remote add ,因为远程存储在配置文件中。

To avoid problems with several git processes modifying the config file simultaneously, git will lock the config file before changing it (by writing a lock file), and release the lock afterwards (by renaming the lock file to the config file). 为了避免同时修改配置文件的几个git进程出现问题,git会在更改之前锁定配置文件(通过写入锁定文件),然后释放锁定(通过将锁定文件重命名为配置文件)。

The error message 错误消息

error: could not commit config file .git/config

means that git could not properly release this lock. 意味着git无法正确释放此锁。 This probably means that either another process was working on the same file, or there was some kind of filesystem error (or there's a bug in git or your OS/libraries). 这可能意味着另一个进程正在处理同一个文件,或者存在某种文件系统错误(或者git或您的OS /库中存在错误)。

Unfortunately, git does not tell you what exactly was the problem, so you'll have to manually debug this. 不幸的是,git没有告诉你究竟是什么问题,所以你必须手动调试它。 You could try running git with dtruss to see what exactly is going wrong. 您可以尝试使用dtruss运行git,看看到底出了什么问题。

This could be a permissions issue, especially for automated jobs running on Windows that can have fewer permissions than an interactive login of the same user. 这可能是权限问题,尤其是对于在Windows上运行的自动作业,其权限少于同一用户的交互式登录。 From this answer on ServerFault : 这个关于ServerFault的答案

Each logon session to a Windows (NT-based versions, that is) machine has a "security token"-- a data structure that describes, amongst other things, the groups that the user represented by the token is a member of. 每个到Windows(基于NT的版本,即机器)的登录会话都有一个“安全令牌” - 一种数据结构,其中描述了令牌所代表的用户所属的组。

The "Interactive" identity isn't a group that you can manually place members into, but rather is added by the operating system, automatically, when a security token is constructed for a user who has logged-on via the Windows Graphical User Interface. 当为通过Windows图形用户界面登录的用户构建安全令牌时,“交互式”标识不是可以手动将成员放入的组,而是由操作系统自动添加的组。 This is similar to the "Network" identity, which is added automatically to tokens created for users who are accessing the machine via the network. 这与“网络”身份类似,后者会自动添加到为通过网络访问计算机的用户创建的令牌。

These automatically-generated group memberships allow you to construct permissions that might allow or deny access to resources based on how the user is accessing the machine. 这些自动生成的组成员身份允许您根据用户访问计算机的方式构建可能允许或拒绝访问资源的权限。 This supplements the permission system's default behavior of arbitrating access based on who is accessing the resource. 这补充了权限系统基于访问资源的人仲裁访问的默认行为。

暂无
暂无

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

相关问题 安装Carthage时出现“error: could not lock config file.git/config: Permission denied”的错误 - Error of "error: could not lock config file .git/config: Permission denied" occurs while installing Carthage 错误的错误消息“无法锁定配置文件.git / config:权限被拒绝”,原因是未进行分阶段的更改; 在安装openJDK 8时在Homebrew中 - error of “could not lock config file .git/config: Permission denied” due to unstaged changes; in Homebrew while installing openJDK 8 无法使Tower(OSX git GUI)忽略文件权限–“无法锁定配置文件.git / config”错误 - Can't get Tower (OSX git GUI) to ignore file permissions – “could not lock config file .git/config” error Git直接将文件提交到git和/或gitlab - Git directly commit file to git and/or gitlab git 推送挂起...可能与 ssh 配置相关 - git push hangs… could be ssh config related Git无法展开包含路径'〜/ .gitcinclude',致命:/ usr / local / git / etc / gitconfig中的错误配置文件第49行 - Git Could not expand include path '~/.gitcinclude', fatal: bad config file line 49 in /usr/local/git/etc/gitconfig 从 1password ssh-agent 恢复后,Git 提交“错误:无法连接到套接字。代理正在运行吗?致命:无法写入提交对象” - Git commit "error: Could not connect to socket. Is the agent running? fatal: failed to write commit object" after reverting from 1password ssh-agent git rm提交后,MacOS上的Git恢复文件 - Git on MacOS restoring file after commit when doing a git rm 我想构建一个本地Git存储库。 我正在使用配置文件。 我有一个错误 - I want to construct a local Git repository. I am using the config file. I got an error ssh 配置文件 git on mac timeout - ssh config file for git on mac timeout
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM