百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> git 推送至svn使用步骤详解
分享文章到:

git 推送至svn使用步骤详解

发布时间:01/15 来源: 浏览: 关键词:
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:


[auth]
password-stores =
Which means that the variable password-stores is explicitly set to the empty string (background is that svn now contains support for some key-agent tools - and the interfacing to the default configured ones may be fragile - resulting in silent ignoring of the above options and non-caching behaviour).
When using svn for the first time, the hierachy $HOME/.subversion is created after the first svn operation - e.g. when doing the first checkout. Subversion creates then the mentioned files and fills them with the most important options - commented out, including some documentation.
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

本地修改代码后提交
这个跟没用svn时一样,不提.
同步远程svn 服务器

git svn rebase

我个人的理解就是,这里相当于svn里的svn up 命令.

Before committing back to Subversion, you will want to update to apply any new changes in the repository to your local Git repo.
This will download all new changesets from Subversion, apply them to the last checkout from Subversion, and then re-apply your local changes on top of that.
推送到远程svn服务器

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

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有3人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板