1.克隆 git svn clone svn://192.168.1.236/test(如果有其它需要,可以增加clone参数)
2.git同步svn: git svn rebase
3.gitlab远程:git remote add origin git@192.168.1.237:root/bmh.git
4.上传:git push -u origin master
5.有svn更新就继续git svn rebase,git push
6.cat /home/script/svn-git.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
os,time
print
time.ctime()
dirname
=
os.getcwd()
home
=
r
'/home/bmh'
if
dirname
is
home:
os.system(
'git svn rebase'
)
os.system(
'git push'
)
else
:
os.chdir(home)
os.system(
'git svn rebase'
)
os.system(
'git push'
)
|
7.crontab -l
* */3 * * * /usr/bin/python /home/script/svn-git.py >> /var/log/svn-git.log
本文转自YU文武貝 51CTO博客,原文链接:http://blog.51cto.com/linuxerxy/1860207,如需转载请自行联系原作者