初始化一个新仓库

  1. git init

克隆仓库

  1. git clone https://github.com/xstoop/docker-dev.git
  2. git clone https://github.com/xstoop/docker-dev.git docker #克隆仓库指定文件夹

远程仓库

  1. git remote -v # 查看当前的远程仓库
  2. git remote show [remote-name] # 查看某个远程仓库的详细信息
  3. git remote add pb git://github.com/paulboone/ticgit.git # 添加远程仓库
  4. git fetch [remote-name] # 从远程仓库查看更新,不自动合并到当前工作分支
  5. git pull [remote-name] [branch] # 自动合并到本地仓库中当前分支
  6. git push [remote-name] [branch-name] # 推送数据到远程仓库
  7. git remote rename pb paul # 重命名远程仓库
  8. git remote rm paul # 删除远程仓库

新建一个裸仓库的副本

  1. git init --bare # 新建一个空仓库副本
  2. git clone --bare my_project /opt/git/project.git # 从当前项目新建一个空仓库副本