Configuring Version Control SVN Git under Ubuntu

Reference link

SVN

1. Install SVN

sudo apt-get install subversion

2. Create a version repository

sudo svnadmin create tone_src

3. Configuration

我们需要修改 conf 目录下的三个文件,authz;passwd;svnserve.conf

一 、编辑 svnserve.conf

[general]
#匿名用户不可读
anon-access = none
#权限用户可写
auth-access = write
#密码文件为 passwd
password-db = passwd
#权限文件为 authz
authz-db = authz

二、编辑 authz 制定管理员组 即 admin 组的用户为 tone admin 组有 rw(读写权限) 所有人有 r(读权限)

[groups]
admin= tone

[/]
@admin =rw
*=r

这里组的名字 不一定叫 admin 你的管理员组名 可以叫做任意的名字,另外比如 admin 组还有其他用户,可以这样制定 admin=tone,tone1,tone2 类似这样的写法

三、编辑 passwd 文件 设定用户密码

[users]
# harry = harryssecret
# sally = sallyssecret
tone=www

tone 的密码为 www 对 没看错 明文的。

以上都做完之后,就可以开启你的 svn 服务器了。
四、 启动svnserve
sudo svnserve -d -r /erv/svn/

-d 已守护模式启动

-r 制定 svn 版本库根目录 这样是便于客户端不用输入全路径 就可以访问版本库了

例如:svn://127.0.0.1/tone_src

开启多个版本库的时候要启动不同的端口 svnserve -d --listen-port 3688 -r /static/

4. Stop svnserve

killall svnserve

Git

Use gitblit to download gitblit-1.8.0.tar.gz, install jdk and configure environment variables

$ sudo ./install-service-ubuntu.sh
$ sudo service gitblit start
./gitblit.sh

After successful operation, visit https://localHost:8443 , and you can add the repository in it.

Upload the current SVN project to the git server, the two do not interfere with each other

1. It is very simple under windows, you need to install TortoiseGit and TortoiseSVN

1) Add ignore file, right click to ignore the uploaded file.

2) SVN ignores .git directory and .gitignore

3) Git ignores .svn directory

2. Execute the command in the root directory of the SVN project

#初始化为git项目
 git init 
#把当前作为远程Git仓库 注意admin是用户名,可以改为其他设置了的用户
git remote add origin ssh://admin@localhost:29418/gitTestProject.git
# 必须先 pull
git pull origin master --allow-unrelated-histories
# 再上传到远程仓库
git push -u origin master

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325508085&siteId=291194637