如何建一個新的git project server and client心得
来源:互联网 发布:大数据网站 编辑:程序博客网 时间:2024/05/27 02:28
在server端
首先,創建一個名為 'git' 的用戶
$ sudo adduser git
現在可以用 --bare
選項運行 git init
來建立一個裸倉庫,這會初始化一個不包含工作目錄的倉庫。
$ cd ~ (如果現在打pwd,應該是在/home/git)$ mkdir project.git$ cd project.git$ git --bare init
git use commit times for timestamps
place it (as executable) in the file $GIT_DIR/.git/hooks/post-checkout:
#filename:post-checkout
#!/bin/sh -eOS=${OS:-`uname`}old_rev="$1"new_rev="$2"get_file_rev() { git rev-list -n 1 "$new_rev" "$1"}if [ "$OS" = 'Linux' ]then update_file_timestamp() { file_time=`git show --pretty=format:%ai --abbrev-commit "$(get_file_rev "$1")" | head -n 1` touch -d "$file_time" "$1" }elif [ "$OS" = 'FreeBSD' ]then update_file_timestamp() { file_time=`date -r "$(git show --pretty=format:%at --abbrev-commit "$(get_file_rev "$1")" | head -n 1)" '+%Y%m%d%H%M.%S'` touch -h -t "$file_time" "$1" }else echo "timestamp changing not implemented" >&2 exit 1fiIFS=`printf '\t\n\t'`for file in `git ls-files`do update_file_timestamp "$file"done
在client端
遞迴把.gitignore加入空的資料夾
Filename:.gitignore
1 # Ignore everything in this directory 2 * 3 # Except this file 4 !.gitignore
find ./* -type d -empty | xargs -i cp .gitignore {}
如此便可把空的資料夾加入git管控
在client端$ cd myproject$ git init$ git add -f .$ git commit -m 'initial commit'$ git remote add origin git@gitserver:/opt/git/project.git$ git push origin master
Force add the .gitignore file(See man git add
:)
-f, --force Allow adding otherwise ignored files.
上傳到git server後,變可以使用下面指令下載
$ git clone git@gitserver:/opt/git/project.git
0 0
- 如何建一個新的git project server and client心得
- git 搭建 client/server
- ubuntu git server & client
- svn client and server
- client and server direct
- python client and server
- C++ Server and Client
- socket ---> server and client
- python server and client
- tcp client and server
- Client And Server
- ROS server and client
- Real differences between “java -server” and “java -client”-JVM Server和JVM Client的不同
- 安装Jazz Server and Client
- c# socket(server and client)
- Perl socket client and server
- Simple UDP server and client
- sctp server and client program
- Flash安全设置工具
- Android UI开源组件库BottomView ,第三方自定义UI控件
- maven常用命令
- Linux共享内存
- Mysql 如果数据存在则更新,不存在则插入
- 如何建一個新的git project server and client心得
- IOS-解决自定义UIImagePickerController 后的图片翻转问题
- 数据库三大范式
- Java深入 - Java JNI详解
- shell根据模板创建源程序
- select多路复用
- 在查找预编译头使用时跳过解决
- Android中图像特效处理(圆角、倒影)
- 车牌识别技术