最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】Xcode中svn代码commit出错:Commit failed not under version control (1)

Xcode crifan 3612浏览 0评论

【背景】

之前用xcode上传代码都是OK的

这次后来在添加一些图片,其中一个图片,是xxx@3x.png之类的,修改一些代码后,再去commit结果出错:

The working copy “ios” failed to commit files.

Commit failed (details follow):‘xxx/school_coin_my_coin’ is not under version control (1)

如图:

Commit failed details follow school_coin_my_coin is not under version control 1

此处确保那个报错的文件是存在的:

here xcode indeed exist that png file

 

【解决过程】

1.搜:

xcode svn commit is not under version control (1)

参考:

xcode – Commit failed: .DS_Store ist not under version control – Stack Overflow

xcode – SVN Commit failed for folder/directory – Stack Overflow

ios – Folder is not under version control and is not part of the commit – Stack Overflow

说是:

xcode对于svn的支持不够好:

导致xxx@2x的文件,没发直接commit

-》只能尝试用svn的命令行去上传:

svn add xxx@2x.png

svn commit -m “xxxx"

2.去试试:

结果,好像images下面,真的不存在对应的文件,tab的时候,没有出现对应的图片文件school_coin_my_coin@3x.png:

in terminal indeed tab not show that image file

3.感觉像是:

从xcode中,添加进去的文件,是只添加了对应的文件的引用,而不是文件本身?

那算了,还是:

从别的地方,把文件,通过Finder中复制过去:

via finder manually copy that two image file

然后,再去xcode中commit看看,结果错误依旧。

4.那还是去命令行中commit吧:

结果默认@前加了范斜杠后,失败:

licrifandeMacBook-Pro:xxx crifan$ svn add images/school_coin_
school_coin_my_coin@3x.png  school_coin_top_bg.png
licrifandeMacBook-Pro:xxx crifan$ svn add images/school_coin_my_coin\@3x.png images/school_coin_top_bg.png
svn: warning: W155010: '/Users/crifan/dev/dev_root/ssssss/projects/xxx/ios/code/ios/zxxzzzz/images/school_coin_my_coin' not found
A  (bin)  images/school_coin_top_bg.png
svn: E200009: Could not add all targets because some targets don't exist
svn: E200009: Illegal target for the requested operation

后来才注意到,实际上此时已经可以正常的添加:

images/school_coin_top_bg.png

到svn了。

加上@后缀后,还是失败:

licrifandeMacBook-Pro:xxx crifan$ svn add images/school_coin_my_coin\@3x.png@ images/school_coin_top_bg.png
A  (bin)  images/school_coin_my_coin@3x.png
svn: warning: W150002: '/Users/crifan/dev/dev_root/xxxxx/projects/xxx/ios/code/ios/xxx/images/school_coin_top_bg.png' is already under version control
svn: E200009: Could not add all targets because some targets are already versioned
svn: E200009: Illegal target for the requested operation

后来才注意到:不过实际上已经把

images/school_coin_my_coin\@3x.png@

加进去了。

所以最后再去

licrifandeMacBook-Pro:xxx crifan$ svn add images/school_coin_my_coin@3x.png@ images/school_coin_top_bg.png
svn: warning: W150002: '/Users/crifan/dev/dev_root/xxx/projects/zzz/ios/code/ios/xxx/images/school_coin_my_coin@3x.png' is already under version control
svn: warning: W150002: '/Users/crifan/dev/dev_root/xxx/projects/zzz/ios/code/ios/xxxx/images/school_coin_top_bg.png' is already under version control
svn: E200009: Could not add all targets because some targets are already versioned
svn: E200009: Illegal target for the requested operation
licrifandeMacBook-Pro:xxx crifan$ 

时,显示都已经加入到svn中了。

4.此时,再去xcode中,重新去commit看看:

after terminal svn commit still fail

结果错误依旧。

5.算了,还是只能继续用命令行去commit:

licrifandeMacBook-Pro:xxxx crifan$ svn commit -m "can show my coin background and icon"
Adding         MySchoolCoinViewController.swift
Sending        MyWalletViewController.swift
Sending        xxx.xcodeproj/project.pbxproj
Sending        xxx.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/UserInterfaceState.xcuserstate
Adding  (bin)  images/school_coin_my_coin@3x.png
Adding  (bin)  images/school_coin_top_bg.png
Adding  (bin)  pic_gride1.png
Adding  (bin)  school_coin_my_coin@2x.png
Adding  (bin)  school_coin_my_coin@3x.png
Adding  (bin)  school_coin_top_bg.png
Adding  (bin)  top_bg.png
Transmitting file data ...........
Committed revision 531.
licrifandeMacBook-Pro:xxx crifan$

那再去xcode中commit,希望这次是:出问题的图片文件都已经上传了,只用xcode去上传代码文件,这下应该不会再出问题了吧。

发现已经没什么文件需要添加了:

xcode try commit find nothing to commit

因为上面的命令行中的commit已经都把代码上传过了。

 

【总结】

此处,xcode去commit出现错误:

The working copy “ios” failed to commit files.

Commit failed (details follow):‘xxx/school_coin_my_coin’ is not under version control (1)

的原因是:

1.之前通过xcode添加的对应的图片文件,没有真正添加进来(只添加了文件的引用),导致commit时找不到文件而出错(但是为何xcode的代码可以正常执行?)

办法是:

自己通过finder中手动拷贝和粘贴文件,确保finder中可以看到,且命令行下可以找到这些文件了:

licrifandeMacBook-Pro:xxx crifan$ svn add images/school_coin_
school_coin_my_coin@3x.png  school_coin_top_bg.png
 

2.对于xxx@2x.png之类的文件,不能很好的支持

解决办法是:

去Terminal命令行终端中去commit

先添加文件:

svn add images/school_coin_my_coin\@3x.png@ images/school_coin_top_bg.png

再去上传文件:

svn commit -m “add your comment here"

即可。

转载请注明:在路上 » 【已解决】Xcode中svn代码commit出错:Commit failed not under version control (1)

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
56 queries in 0.082 seconds, using 18.88MB memory