A simple script to sync a forked repository with the source repository

The mechanism is simple like this:

1. Pull/Clone your own repository(which was forked from another repository) to a local PC.
2. Add remote source repository to a tag of the local copy.
3. Do local merge for the two repositories.
4. Resolve the conflications if exists.
5. Commit the local copy to your repository.
6. Done and do some check.

#Sync the forked repository with the original source

#1. First clone the repository of your own.
#Skip this step if you already have a local copy of your own fork repository
git clone https://github.com/jackyhwei/nginx-rtmp-module
cd nginx-rtmp-module

#2. Add remote repository

#Add a tag for your repository and point to the origin source repository
git remote add jackyhwei https://github.com/arut/nginx-rtmp-module

#3. Fetch the newly added tag source
git fetch jackyhwei

#4. Merge the newly fetched source to master
git merge jackyhwei/master

#Manually resolve the conflications if there exists
git commit -m "merged by jackyhwei"

#5. Push the codes to your repository. BTW: git push requires you input your username and password.
git push -u origin master

#6. Check local info
git remote -v  
git branch -a

If you’v made some modification for your own repository, there will be an error like below when you do the push:

Permission denied(publickey).
fetal: The remote end hung up unexpectedly.

It’s because you didn’t add a public key for your repository, use following script to add it:

cd ..
mv .ssh ssh_bak
ssh-keygen #this command will generate a public/private rsa key pair for you.
cd .ssh
ls #there would be two files: id_rsa and id_rsa.pub
vi id_rsa.pub

Copy the contents in id_rsa.pub to your clipboard, and go to the repository administration web page, select the Deploy Keys menu, and Add the deploy key(which is in your clipboard) to it.

Try push again.

正式版SVN服务器安装记录

之前已经发过一次测试版服务器的安装记录,为我在本机安装的虚拟机的操作过程,之后为了应对正式版的服务器,我重新装了一次虚拟机,并且重新将每一步的操作记录明细。一者,为了方便我日后翻查记录,二者,接手工作的人,也可以有一个基本记录可参照。

文本内容主要包含执行过的命令,项目的配置文件在此http://rg4.net/archives/667.html,增加了sshd和dropbox的配置,系统为CentOS 6.2。

Continue reading “正式版SVN服务器安装记录”