最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]xcode 7中把本地代码上传到远程svn服务器上

Xcode crifan 3948浏览 0评论

【背景】

本地打开了一个xcode项目:

xcode open local project

想要上传到一个远程的svn服务器上。

 

【折腾过程】

1.自己去看看Source Control中看看:

xcode source control configure master for project

看了看对应的信息:

configure project info page local

configure project remote no remotes

configure project branches master current

好像应该是:

在remote界面,去添加远程需要上传的地址

 

2.搜:

xcode commit local to svn

xcode commit local project to svn

xcode svn commit local

参考:

iphone – importing a project into a remote SVN server in XCode 5 – Stack Overflow

Committing Files to a Repository

Configuring Xcode to use Subversion

ios – Import a project in SVN from Xcode 5 – Stack Overflow

 

3.算了,先随便去测试吧:

xcode source control commit try

left show tree view of files commit many files

上传试试,结果出错:

a commit message is required to perform this opereation

结果需要输入说明:

input message before commit in xcode

xcode can pair your contacts with source control users for enhanced collaboration

结果出错了:

the working copy failed to error pathspec did not match any files known to git

很明显:

本来此处打算去上传到一个已知的svn服务器到。

结果此处,不知道之前是怎么用了git,然后无法上传:

那就对了,否则都不知道上传到哪个服务器的。。。

 

4.先去:

把(之前看到的此项目中的)本地的隐藏的git目录:

【已解决】mac中如何显示隐藏文件夹

想办法删掉:

move to trash box for dot git folder in xcode

然后再去重新上传到我们自己的svn服务器上去。

5.没了.git,再,双击xxx.xcodeproj,用xcode重新打开项目,果然source control中就没了那么多:

history

commit

之类的了:

xcode project source control no commit and history

但是没看到,哪里有

commit之类的选项

这样就没发,把本地已有的代码,上传到远程svn服务器上了。

6.对于

create working copy

结果是:

create working copies for projects git working copies will be created

很明显,是git的逻辑,而不是svn的逻辑。。。

iphone – importing a project into a remote SVN server in XCode 5 – Stack Overflow

7.去试试:

先去用svn工具去checkout一个,空目录到本地:

但是此处之前是有代码的,所以要:

打开终端:

【已解决】mac中给文件夹右键添加打开终端并定位到此文件夹

然后再去checkout所有文件,

再到命令行中,删除所有的文件:

【已解决】mac的终端中rm无法删除文件夹

然后commit:

licrifandeMacBook-Pro:ios crifan$ svn commit
licrifandeMacBook-Pro:ios crifan$ svn status

才形成:一个新的,服务器端的,空的svn目录,本地也是空的

然后再把xcode代码都放进去:

put project folder into empty folder in finder

然后再去双击xxx.xcodeproj打开xcode的项目:

看看里面是否可以commit进去。

 

8.先是可以看到了历史纪录:

xcode source control history

xcode svn project histroy list

9.然后还真的可以看到commit呢:

xcode source control commit see

xcode commit let file list right no version editor

然后就上传成功了:

xcode svn commit complete no selection

 

【总结】

Xcode 7中,想要上传本地的项目代码到远程svn服务器中,则是:

1.本地创建一个文件夹,然后svn co

得到一个本地的svn的空目录

2.然后把你要上传的代码,都拷贝到该目录中

3.然后用xcode打开项目文件,xcode中就可以去

Source Control-》Commit去上传代码到svn服务器了。

 

【后记】

后来,为了第二次上传更新的一个版本,再次同样的操作了一遍,

结果Xcode打开后,commit却无法commit了,显示出错了。

无法commit。

所以搞的最后实在不行,就还是去通过命令行中去commit了:

licrifandeMacBook-Pro:ios crifan$ svn commit -m "zzz edit network related code"
Sending        xxxxxx/xxxxxx.xcodeproj/project.pbxproj
Adding         xxxxxx/xxxxxx.xcodeproj/project.xcworkspace/xcshareddata
Adding         xxxxxx/xxxxxx.xcodeproj/project.xcworkspace/xcshareddata/xxxxxx.xcscmblueprint
Adding         xxxxxx/xxxxxx.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad
Adding  (bin)  xxxxxx/xxxxxx.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/UserInterfaceState.xcuserstate
Sending        xxxxxx/xxxxxx.xcodeproj/project.xcworkspace/xcuserdata/zzz.xcuserdatad/UserInterfaceState.xcuserstate
Adding         xxxxxx/xxxxxx.xcodeproj/xcuserdata/crifan.xcuserdatad
Adding         xxxxxx/xxxxxx.xcodeproj/xcuserdata/crifan.xcuserdatad/xcschemes
Adding         xxxxxx/xxxxxx.xcodeproj/xcuserdata/crifan.xcuserdatad/xcschemes/xxxxxx.xcscheme
Adding         xxxxxx/xxxxxx.xcodeproj/xcuserdata/crifan.xcuserdatad/xcschemes/xcschememanagement.plist
Sending        xxxxxx/xxxxxx.xcodeproj/xcuserdata/zzz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
...
Sending        xxxxxx/controller/tabcontroller/newideascontroller/ServiceViewController.swift
Deleting       xxxxxx/model/network/HTTPRequestSerializer.swift
Deleting       xxxxxx/model/network/HTTPResponseSerializer.swift
Sending        xxxxxx/model/network/HTTPSecurity.swift
Deleting       xxxxxx/model/network/HTTPStatusCode.swift
Deleting       xxxxxx/model/network/HTTPTask.swift
Deleting       xxxxxx/model/network/HTTPUpload.swift
Adding         xxxxxx/model/network/Operation.swift
Adding         xxxxxx/model/network/Request.swift
Adding         xxxxxx/model/network/StatusCode.swift
Adding         xxxxxx/model/network/Upload.swift
Transmitting file data ................................
Committed revision 476.
licrifandeMacBook-Pro:ios crifan$

然后去xcode中再去update一下后:

xcode source control update once

然后再去commit,就可以正常检测出变化了:

after update xcode commit show modified files

 

以后就可以继续正常的,通过xcode去update和commit了。

转载请注明:在路上 » [已解决]xcode 7中把本地代码上传到远程svn服务器上

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.163 seconds, using 22.15MB memory