将〜/ .gitconfig选项[push.default]更新为“simple”后,无法在XCode 4.5.1中创建快照。 [英] Unable to create a snapshot in XCode 4.5.1 after update the ~/.gitconfig option [push.default] to "simple"

查看:108
本文介绍了将〜/ .gitconfig选项[push.default]更新为“simple”后,无法在XCode 4.5.1中创建快照。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在XCode 4.5.1中为我的项目创建快照。但现在同一个项目只是不停地告诉我:

 无法创建快照
错误:格式错误的推送值.default:简单
错误:必须是无,匹配,跟踪或当前之一。
fatal:在/Users/oppih/.gitconfig中配置文件第21行

我记得当我今天将另一个项目推入github ealier时,系统提示我发出以下警告:

 警告:push.default未设置;它的隐含价值在
Git 2.0中从匹配变为简单。要压制此消息
并在默认更改后维护当前行为,请使用:

git config --global push.default匹配

若要压制此消息并现在采用新的行为,使用:

git config --global push.default simple

所以我搜索了它,并且不久之前发现了这个问题: 13148066 ,并且解决了,我使用 git config --global push.default简单因为这是一种更直观的行为,这就是为什么默认情况正在改变。



我认为我的XCode问题必须与此git选项更新有关。



回到XCode,我没有选择在我的系统中设置git repo XCode项目,但使用快照作为备份我的方式代码。我认为在XCode的快照中有一些技巧,我无法弄清楚。现在我想知道是否有人可以告诉我如何重新启用XCode中的快照(而不是更改.gitconfig [push.default]选项)?

解决方案

我设法解决了我自己的问题。有关详细信息,请参见问题10449374



在这种情况下的主要问题是:Xcode只是在/Applications/Xcode.app/Contents/Developer/usr/中安装(与命令行工具一起)它自己的git版本bin。

不知何故,Xcode也硬编码它会使用它自己的工具版本(例如git)。 (我不知道为什么)Xcode的快照功能与git有一些整合。

所以,当我:


  1. 通过自制程序安装了新版本的git,

  2. 更新〜/ .gitconfig中新的push.default选项,

  3. 想在Xcode项目中创建一个快照

然后我会遇到上面描述的问题。 >

以下是我的解决方案:


  1. 更改为Xcode目录:



    cd /Applications/Xcode.app/Contents/Developer/usr/bin


  2. 像这样重命名Xcode的git:
    $ b $ p $ sudo mv ./git ./git-xcode-usr-bin


  3. 链接我自己的git,通过自制程序安装: $ b sudo ln -s / usr / local / bin / git ./git


我对 / usr / bin / git

做了同样的事情
$ b

  sudo mv / usr / bin / git / usr / bin / g it-xcode-usr-bin 
sudo ln -s / usr / local / bin / git / usr / bin / git

这会实际地链接 /usr/local/Cellar/git/1.8.0/bin/git (因为我使用git 1.8。 0目前)

这有点棘手,如果我将来升级homebrewed git,我必须更新链接。 Xcode的快照和新的push.default选项确实可以正常工作。


I was able to create a snapshot for my project in XCode 4.5.1. But now the same project just keeps telling me that:

Unable to create a snapshot
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 21 in /Users/oppih/.gitconfig

I remember that when I pushed another project onto github ealier today, I was prompted with this warning:

warning: push.default is unset; its implicit value is changing in 
Git 2.0 from 'matching' to 'simple'. To squelch this message 
and maintain the current behavior after the default changes, use: 

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use: 

  git config --global push.default simple

So I googled it and find this question not so long ago: 13148066, and got it settled, I use git config --global push.default simple since "This is a more intuitive behavior, which is why the default is getting changed to this."

I think my problem with XCode must have a connection with this git option update.

Back to XCode, I did not choose to setup a git repo in my XCode project, but used the snapshot as a way to backup my code. I think there's some trick with git in XCode's snapshot, I cannot figure it out. Now I wonder if anyone can tell me how to re-enable the snapshot in XCode (while not to change the .gitconfig [push.default] option)?

解决方案

I managed to solve my own problem. See it in Question 10449374 for the related details.

The main problem in this case is that: Xcode just install (along with the Command Line Tools) its own version of git in /Applications/Xcode.app/Contents/Developer/usr/bin .

And somehow, Xcode also hard coded it would use its own version of tools (such as git). And (I don't know why) Xcode's "snapshot" feature has some integration with git.

So when I:

  1. installed a new version of git via homebrew,
  2. update the new push.default option in ~/.gitconfig ,
  3. want to create a snapshot in an Xcode project

Then I will encounter the problem I described above.

Here's my solution:

  1. change into the Xcode directory:

    cd /Applications/Xcode.app/Contents/Developer/usr/bin

  2. rename the Xcode's git like this:

    sudo mv ./git ./git-xcode-usr-bin

  3. link my own git which is installed through homebrew:

    sudo ln -s /usr/local/bin/git ./git

And I did the same thing with /usr/bin/git

sudo mv /usr/bin/git /usr/bin/git-xcode-usr-bin
sudo ln -s /usr/local/bin/git /usr/bin/git

This will acctually link /usr/local/Cellar/git/1.8.0/bin/git (because I'm use git 1.8.0 at the present)

It's a little tricky, and I have to update the link if I upgrade the homebrewed git in the future. And it really works fine with Xcode's snapshot and the new push.default option.

这篇关于将〜/ .gitconfig选项[push.default]更新为“simple”后,无法在XCode 4.5.1中创建快照。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆