加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_丽江站长网 (http://www.0888zz.com/)- 科技、建站、数据工具、云上网络、机器学习!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

git 推送至svn使用流程详解

发布时间:2022-06-11 16:35:23 所属栏目:Linux 来源:互联网
导读:svn是同步版本控制工具而git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项了,下面我们就一起来git 推送至svn使用方法,希望下文能够帮助到大家. 一,配置svn 保存明文密码 这样,使用git推的时候,就不会每次询问密码了. With recen
  svn是同步版本控制工具而git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项了,下面我们就一起来git 推送至svn使用方法,希望下文能够帮助到大家.
 
  一,配置svn 保存明文密码
 
  这样,使用git推的时候,就不会每次询问密码了.
 
  With recent versions of Subversion (~ 1.8) you can configure password caching via $HOME/.subversion/servers:
   
  [global]
  store-passwords = yes
  store-plaintext-passwords = yes
  But depending on your system this may be not enough. If it is not, make sure that $HOME/.subversion/config contains:
   
   Thus, it also makes sense to move an old $HOME/.subversion directory away to have a well-defined starting point.
  Another pitfall are permissions - i.e. files which are not readable under $HOME/.subversion - but this should not often be the problem, because when svn creates them, it takes care of the right permissions (e.g. the auth directory is only readable by the user then, not by the group/all, independent of the configured umask).
  看了下,修改过配置后,保存的密码是明文的,如:
 
  ┌─[sh4d0walker@HuangYe] - [~/.subversion/auth/svn.simple] - [Wed Jul 09, 02:46]
  └─[$] <> cat 1902b28055f9b44a3128bef8bfcaf4fc  
  K 8
  passtype
  V 6
  simple
  K 8
  password
  V 8
  pw123456
  K 15
  svn:realmstring
  V 31
  <svn://172.16.7.253:81> prj2014
  K 8
  username
  V 6
  abcdef
  END
  可以看到,这里有仓库地址,用户名(abcdef)和明文密码(pw123456),K 和 V后面那个数字表示的是值的字符长度.
 
  二,git 开始拉取svn仓库中的代码
 
  git svn clone -s svn://172.16.7.253:81/prj2014/myprj/
 
  注意最后面的/ 一定不能忘记了,不然没法clone. svn 就是这样,忍受下吧.
 
  The -s is there to signify that my Subversion repository has a standard layout (trunk/, branches/, and tags/.) If your repository doesn’t have a standard layout, you can leave that off.
 
  -s 参数表示使用的是svn标准命名方法,即 trunk,tags,branches,这个参数有时很重要,建议使用,命 令后面还可以加个文件夹名字作为clone后的目录
 
  git svn fetch
 
  可能碰到只想从某个版本开始进行fetch,那么请需要 –r 参数,例如:
 
  $ git svn fetch -r 1342:HEAD
 
  When you’re ready to commit back to Subversion, execute:
 
  git svn dcommit
 
  日常修改和提交,与git的工作流程完全一样,为了方便合并,减少不必要的麻烦,最好保持主分支master不变,在一个新的分支进行日常工作.
 
  切回master从SVN获取最新代码:
 
  $ git checkout master
  $ git svn rebase
  master同步后,与工作分支合并.
 
  $ git checkout work
  $ git rebase master     ## 手工解决可能的冲突
  最后说下,git-svn初始化,这个应该用得少.
 
  git svn init SVNREMOTEURL.

(编辑:应用网_丽江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读