Setup Git

http://www.tomdalling.com/blog/software-processes/how-to-set-up-a-secure-git-server-at-home-osx/

* /etc/ssh/sshd_config, must delete the comment tag "#"

touch .ssh/authorized_keys  //new file
open -a "TextEdit" .ssh/authorized_keys  //open with textedit

1) 在 server 端创建空的 repository  //initialize server git

$ cd path/to
$ mkdir newrepo.git
$ cd newrepo.git
$ git init --bare
# --bare flag 只是用来存储 pushes,不会当做本地 repository 来使用的。

    2) 在 client 端,创建 local repository 并 push  //creat local git and add to remote

$ cd path/to
$ mkdir newrepo
$ cd newrepo
$ git init
$ touch README
$ git add .
$ git commit -m "initial commit"
$ git remote add origin git@yourComputerName:/path/to/newrepo.git # 如果直接之前在 server 端创建的 newrepo.git 是在 home 目录,则这里地址为:git@yourComputerName:newrepo.git
$ git push origin master

猜你喜欢

转载自shappy1978.iteye.com/blog/2288096