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

[已解决]Xcode中git提交失败:error pathspec Assets.xcassets images Contents.json did not match any file(s) known to git

Git crifan 1597浏览 0评论
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_image.imageset/Contents.json’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_image.imageset/jd_icon_83.5@2x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_image.imageset/jd_icon_83.5@3x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_image.imageset/jd_icon_83.5.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/NavigationBar/navi_switch_team_down.imageset/navi_switch_team_down.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/NavigationBar/navi_switch_team_down.imageset/navi_switch_team_down@2x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/NavigationBar/navi_switch_team_down.imageset/Contents.json’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/NavigationBar/navi_switch_team_down.imageset/navi_switch_team_down@3x.png’ did not match any file(s) known to git.

后来又遇到一次:

error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_logo.imageset/launch_logo@2x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_logo.imageset/launch_logo@3x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/launch_logo.imageset/launch_logo.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_jiandao.imageset/Contents.json’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_slogan.imageset/launch_slogan.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_slogan.imageset/launch_slogan@3x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_jiandao.imageset/launch_jiandao@2x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_slogan.imageset/Contents.json’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_jiandao.imageset/launch_jiandao.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_jiandao.imageset/launch_jiandao@3x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/launch_slogan.imageset/launch_slogan@2x.png’ did not match any file(s) known to git.
error: pathspec ‘JianDao/JianDao/Assets.xcassets/Launch/Contents.json’ did not match any file(s) known to git.

但是,此处我确保,所有的Assets中的图片等资源都是存在,正常,可以工作的:

搜:

error pathspec Assets.xcassets images Contents.json did not match any file(s) known to git

error pathspec Assets.xcassets  did not match any file(s) known to git

error pathspec did not match any file known to git

git checkout 报错原因 (error: pathspec ‘master’ did not match any file(s) known to ) – – ITeye技术网站

去terminal中看看:

licrifandeMacBook-Pro:iOS-Client crifan$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Changes to be committed:
  (use "git reset HEAD <file>…" to unstage)
new file:   JianDao/JianDao/Assets.xcassets/launch/Contents.json
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_jiandao.imageset/Contents.json
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_jiandao.imageset/launch_jiandao.png
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_jiandao.imageset/launch_jiandao@2x.png
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_jiandao.imageset/launch_jiandao@3x.png
renamed:    JianDao/JianDao/Assets.xcassets/launch_logo.imageset/Contents.json -> JianDao/JianDao/Assets.xcassets/launch/launch_slogan.imageset/Contents.json
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_slogan.imageset/launch_slogan.png
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_slogan.imageset/launch_slogan@2x.png
new file:   JianDao/JianDao/Assets.xcassets/launch/launch_slogan.imageset/launch_slogan@3x.png
deleted:    JianDao/JianDao/Assets.xcassets/launch_logo.imageset/jd_icon_83.5.png
deleted:    JianDao/JianDao/Assets.xcassets/launch_logo.imageset/jd_icon_83.5@2x.png
deleted:    JianDao/JianDao/Assets.xcassets/launch_logo.imageset/jd_icon_83.5@3x.png
modified:   JianDao/JianDao/Base.lproj/LaunchScreen.storyboard
modified:   JianDao/LoginViewController.swift
Untracked files:
  (use "git add <file>…" to include in what will be committed)
JianDao/JianDao/Assets.xcassets/Launch/launch_logo.imageset/
licrifandeMacBook-Pro:iOS-Client crifan$

Xcode中看看:

Clean后,再去Commit试试,然后发现:

等了1秒左右,就刷出来了:

原先缺少的:launch_logo.imageset

让去提交:

还是出错:

Coderwall | Git – Error: pathspec 'develop' did not match any

licrifandeMacBook-Pro:iOS-Client crifan$ git show-ref
fe61331502271a8c7805a01b2b0bd2f65ab8c772 refs/heads/fixbug_websocket_connect
ef82130304bad3e9e40340dd55ec301a3c40d7ff refs/heads/image_preview
6fa4262ba6f0f537eeeca198236527ffc413de33 refs/heads/master
6fa4262ba6f0f537eeeca198236527ffc413de33 refs/heads/update_ui
691220d50435a275769a4c3f5ada8857054ca085 refs/heads/v1.0
6fa4262ba6f0f537eeeca198236527ffc413de33 refs/remotes/origin/master
691220d50435a275769a4c3f5ada8857054ca085 refs/remotes/origin/v1.0
406cd0aad534463b7321203b941d78e759137f0f refs/tags/image_preview
ed9e4b141e910c9c0388deba4c017017e7b890e4 refs/tags/v0.8
licrifandeMacBook-Pro:iOS-Client crifan$

好像是:

难道Xcode本身有bug?

重启一下Mac试试

结果果然可以了。。。

【总结】

最后证明了是:

Mac本身出了问题

-》长时间使用Mac没有关机

-》Xcode出现异常现象,包括此处的Xcode无法通过git提交代码

-》重启Mac后,Xcode恢复正常,可以正常通过git提交代码了。

转载请注明:在路上 » [已解决]Xcode中git提交失败:error pathspec Assets.xcassets images Contents.json did not match any file(s) known to git

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
59 queries in 0.145 seconds, using 18.71MB memory