postgresql 就放在github上, github上有很多开源软件. 本文简单的介绍一下github的使用. 以后的代码可以尽量往上放, 大家可以帮忙修修补补.
https://github.com/
假设注册的信息如下, 后面需要用到.
用户名 : digoal
邮箱 : digoal@126.com
密码 : test
2. 新建一个Repository
例如 : sky_postgresql_cluster
编写 README.md
3. 安装git客户端, windows 下的安装参考 :
http://code.google.com/p/msysgit/downloads/list
4. 使用git客户端, 创建一个本地的repository
使用 git(linux) 或者 git bash (windows).
首先, git要求使用者必须提供自己的身份标识, 为此我们需要在git bash中执行以下命令 :
git config --global user.name 'digoal'
git config --global user.email digoal@126.com
创建repository的所在目录(在git bash中完成, 或者是linux中在linux shell中完成)
cd c:/users/digoal
mkdir git
初始化 :
cd git
git init
执行此操作后, git将在repository目录下创建一个隐藏目录(.git), 这个目录就是git用来管理软件版本的仓库.
5. 使用git客户端, 将本地的repository 推送到github站点.
首先把代码拷贝到本地的repository目录中, 也就是c:/users/digoal/git
第一次使用本机连接github上的repository推送代码时, 需要添加本机的ssh public key到github.com里面. 添加方法如下 :
本机 (如 windows git bash) 执行 :
ssh-keygen -C 'digoal@126.com' -t rsa
一路默认就可以了, 然后找到这个公钥. 把公钥的内容拷贝到github.com里面( 在github的 account set -> ssh keys -> add ssh key ).
添加后测试是否可以连接github.com
ssh -v git@github.com
如果提示你的密钥不正确, 那么你需要重新确认上一步的操作是否完整无误.
关于分支, 在github.com的repository的admin -> option -> default branch可以看到, 默认是master. 这个等会也要用到.
推送分几步, (第一次)把代码加到本地的库目录中, remote add, pull(from remote), 添加, 提交, 推送.
如 :
cp INSTALL TUTORIAL c:/users/digoal/git
git remote add sky_postgresql_cluster git@github.com:digoal/sky_postgresql_cluster.git
git pull sky_postgresql_cluster master
cd c:/users/digoal/git
git add . (点表示加全部) 或 git add INSTALL TUTORIAL (指定文件名)
git commit -m '注释'
git push sky_postgresql_cluster master
例如我的第一个github repository :
【git 入门站点】
【git 命令】
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help <command>' for more information on a specific command.