如何把ios代码放在svn服务器
1如何使用Xcode5 SVN从公司服务器 check out项目
Choose Source Control > Check Out
Select the repository you want to check out, and click Next
You can select your repository from the Repositories tab, the Favorites tab, or the Recents tab If you know the location of the repository you want to check out, you can also enter the address manually
If Xcode is unable to automatically identify the trunk and branches, use the browser window to select the correct project location, and click Next
In the Checkout window, select the branches and working copies to check out, and click Next
You will be presented only with the necessary options for your repository If your project contains only one working copy, you will only have to select the branch to checkout If your project doesn’t contain branches, you will only be given an option of working copies to checkout If you project is a single working copy with no branches, this dialog will be skipped entirely
Select the location to store the working copy, and click Check Out
2当有修改时,在Source Control里面可以做点什么,我试了下commit,可以提交到本地,但是没有提交到服务器,中间包括-1012错误,然后配置git用户名跟邮箱。然后填写版本注释,然后就提交,看似提交成功,服务器上却没有。
3Push local changes:我点击了试试,就出来下面这个,我有点疑惑,后来发现人家是
然后我就有点怀疑,难道Xcode自带的SVN的subversion类型不支持提交到服务器这个功能么。
然后看帮助文档,有这么一句。
If you’re using Subversion, a commit operation copies the changes from selected files into the remote Subversion repository Therefore, you must be connected to the repository before you can commit changes (For details, see your repository administrator)
搞了半天不懂 see your repository administrator是什么意思。翻译出来是库管理员。我只想说看他有个毛用。我自能默默自嘲英文差。
4然后我就想着再继续往下看。Updating or Pulling Changes from a Repository
如何更新和提交更改。然后就看到下面的内容。
Update your project with changes from the repository using the Source Control menu
For a Git repository, choose Source Control > Pull
For a Subversion repository, choose Source Control > Update
For a project that contains both Git and Subversion repositories, choose Source Control > Update and Pull
For projects with multiple repositories, select the ones you want to update
Resolve differences by using the left and right buttons to specify which file’s contents to use
After reconciling all differences, click Pull (Git) or Update (SVN) to complete the operation
打开Source Control就没有找到Pull和Update。本来就英文差,他妈的刚巧就认得这几句,然后就此作罢。大牛莫要嘲笑我,还请告知我是哪里出了问题。
看了一个问答,XCODE5中怎么上传到SVN服务器,老外给出的结论是:两个办法,一个是用svn client,客户端软件;另一个方法是命令行。One way is using an svn client The one which is obviously available is the command line svn client
http://stackoverflowcom/questions/18894195/xcode-5-export-project-to-svn-repository
但是事情不能不做,就在网上找了命令实验了一下,尽可能写的详细点,下次看的时候好懂。随便帮帮跟我一样正在郁闷的人。
1更改配置(不懂的话就直接跳过吧)
bogon:~ chenshuangchou$ open ~/subversion/config
启动配置文件,然后在配置文件中选择要忽略的文件类型
找到 global-ignores 一行,去掉注释,编辑成
global-ignores = build ~nib so pbxuser mode perspective
# global-ignores = o lo la al libs so so[0-9] a pyc pyo
找到 enable-auto-props = yes 把注释去掉,在[auto-props] Section声明以下文本文件
mode = svn:mime-type=text/X-xcode
pbxuser = svn:mime-type=text/X-xcode
perspective = svn:mime-type=text/X-xcode
pbxproj = svn:mime-type=text/X-xcode
2import命令
首先将本地代码import到版本库
bogon:~ chenshuangchou$ svn import /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper https://19216821248:8443/svn/BuickIOS/ -m "initial import"
3checkout命令
然后从版本库checkout出来,这个目录就相当于被激活,内部跟服务器地址关联。
bogon:~ chenshuangchou$svn checkout https://19216821248:8443/svn/BuickIOS/ /Users/chenshuangchou/Desktop/BuickIOS
4add命令
当有新增的文件时用add指令,增加到版本库,然后提交
svn add /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
执行这条指令的前提是/Users/chenshuangchou/Desktop/BuickIOS/是从服务器checkout下来的目录,也就是is a working copy
新增成功的话会有
A (bin) Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
5commit命令
提交内容到版本库
bogon:~ chenshuangchou$ svn commit -m "添加了一个油耗柱状图" /Users/chenshuangchou/Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
提交到版本库成功的话,
Adding (bin) Desktop/BuickIOS/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
Transmitting file data
Committed revision 3
6update命令
更新版本库到本地,更新指定目录,svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。
bogon:~ chenshuangchou$ svn update /Users/chenshuangchou/Desktop/BuickIOS1
更新成功
Updating 'Desktop/BuickIOS1':
A Desktop/BuickIOS1/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
Updated to revision 3
回退到版本2:
bogon:~ chenshuangchou$ svn update -r 2 Desktop/BuickIOS1/
回退成功的话
Updating 'Desktop/BuickIOS1':
D Desktop/BuickIOS1/Buickhousekeeper/ViewControllers/CarViewController/FuelManageViewController/lastmouth_color1png
Updated to revision 2
冲突
(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件 ,然后清除svn resolved,最后再提交commit)
在提交时发生版本冲突会怎么样
bogon:~ chenshuangchou$ svn commit -m "在delegate中加入了一句话" /Users/chenshuangchou/Desktop/BuickIOS/
Sending Desktop/BuickIOS/git/index
Sending Desktop/BuickIOS/Buickhousekeeper/AppDelegateh
Sending Desktop/BuickIOS/Buickhousekeeperxcodeproj/projectxcworkspace/xcuserdata/chenshuangchouxcuserdatad/UserInterfaceStatexcuserstate
Transmitting file data
Committed revision 4
bogon:~ chenshuangchou$ svn commit -m "在delegate中加入了一句不同的话" /Users/chenshuangchou/Desktop/BuickIOS1/
Sending Desktop/BuickIOS1/git/index
svn: E160042: Commit failed (details follow):
svn: E160042: File or directory 'git/index' is out of date; try updating
svn: E160024: resource out of date; try updating
out of date表示版本过期,可能是由于另外的开发者更新了服务器版本,而本地代码与服务器冲突
遇到这种情况,应该先从服务器update一下,然后再提交
bogon:~ chenshuangchou$ svn update Desktop/BuickIOS1/
Updating 'Desktop/BuickIOS1':
Conflict discovered in '/Users/chenshuangchou/Desktop/BuickIOS1/git/index'
Select: (p) postpone,
(mf) mine-full, (tf) theirs-full,
(s) show all options:
在这里会有一个选择,选择(s)会显示所有选项的所有注释,如下
(s) show all - show this list
(e) edit - change merged file in an editor
(df) diff-full - show all changes made to merged file
(r) resolved - accept merged version of file
(dc) display-conflict - show all conflicts (ignoring merged version)
(mc) mine-conflict - accept my version for all conflicts (same)
(tc) theirs-conflict - accept their version for all conflicts (same)
(p) postpone - mark the conflict to be resolved later。
(mf) mine-full - accept my version of entire file (even non-conflicts)
(tf) theirs-full - accept their version of entire file (same)
选择一个之后会继续显示冲突点,直到完。而每一个点都会询问怎么处理。
G Desktop/BuickIOS1/Buickhousekeeperxcodeproj/projectxcworkspace/xcuserdata/chenshuangchouxcuserdatad/UserInterfaceStatexcuserstate
Conflict discovered in '/Users/chenshuangchou/Desktop/BuickIOS1/Buickhousekeeper/AppDelegateh'
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options: tf
G Desktop/BuickIOS1/Buickhousekeeper/AppDelegateh
Updated to revision 4
需要确定你用的是独立服务器还是虚拟空间,如果是独立服务器可以远程桌面连接,那么可以直接登录远程桌面修改代码 如果是虚拟空间的话, 需要用FTP软件来连接服务器,找到文件进行修改我经常在服务器上和ftp里修改文件 不明白的可以追问
简单的说,网页制作好后,网页文件将放在一台电脑上,这台电脑通常称为服务器,其他人在浏览器中输入网址时,就等于是对服务器说:“把某某页面文件给我看下”,于是服务器就去找那个页面并发给浏览器,浏览器将页面下载到临时文件夹中并显示出来,这样我们就看到网页了。 如果请求的是html这种静态页面时,服务器上基本不用执行什么的,直接扔给浏览器就可以了;如果请求的是asp,aspnet,php等动态页面时,服务器就要针对不同的语言做不同的处理,然后再给浏览器; 简单的说就是这样了,其实平时我们不必去关心服务器具体怎么执行,我们只要根据学的知识把页面做好传上去就可以了。
首先确保你的本地git工作目录下已经增加了远程分支了使用 git remote -v 查看。如果没有则先使用 git remote add 命令添加一个(假设名为origin,分支为master)。如果已经有了,则使用 git push origin master命令提交当前工作目录下的分支到远程master分支
0条评论