首页 / 操作系统 / Linux / Git搭建团队开发环境操作演练
模拟创建远程git仓库1.首先创建如下目录结构:/Users/hujh/Desktop/GitTest2/GitServer/weiboweibo是我们要创建的项目2.切换目录$ cd /Users/hujh/Desktop/GitTest2/GitServer/weibo3. 建立空白代码库(专门用于团队开发)$ git init —bare正常一般能显示类似如下结果代表初始化空仓库成功Initialized empty Git repository in /Users/hujh/Desktop/Git演练/GitServer/weibo/项目经理初始化本地仓库1.项目经理创建如下目录结构:/Users/hujh/Desktop/GitTest2/Manager2.切换目录$ cd /Users/hujh/Desktop/GitTest2/Manager/weibo3.”克隆"代码库到本地$ git clone /Users/hujh/Desktop/GitTest2/GitServer/weibo/显示提示结果如下:Cloning into "weibo"...warning: You appear to have cloned an empty repository.done.代表克隆仓库成功,您可以进入weibo目录通过ls -la查看到如下图结果:有一个.git目录,这就是仓库的隐藏目录。4.个人信息配置(因为要演示一台机器上的多人协作,日常开发可以忽略)$ git config user.name manager$ git config user.email manager@163.com5.添加.gitignore文件指定哪些文件不纳入版本库的管理参考网址:https://github.com/github/gitignore1)在.git目录的同级目录中将如下命令粘贴执行echo -e "# Xcode#build/*.pbxuser*.mode1v3*.mode2v3*.perspectivev3xcuserdata*.xccheckout*.moved-asideDerivedData*.hmap*.ipa*.xcuserstate# CocoaPods## We recommend against adding the Pods directory to your .gitignore. However# you should judge for yourself, the pros and cons are mentioned at:# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control## Pods/" > .gitignore2)通过ls -la查看,可以看到生成了一个.gitignore文件3)执行如下命令,将.gitignore添加到代码库$ git add .gitignore $ git commit .gitignore -m “添加.gitignore忽略文件"6.创建初始化项目利用Xcode在weibo目录下创建项目,注意当我们选择保存地址进入weibo目录时,Create Git repository 选项卡编程灰色了。编写和修改代码后,选择Source Control ——->Commit 提交我们的代码:在弹出的界面中进行操作,参考图中说明:上图中我没有选择自动推送,在项目开发中为了节约时间,可以勾选此项,这里不勾选是为了告诉大家如何手动推送:选择SourceControl ——> push然后点击push如果推送成功,会显示push successful,这就代表推送到远程仓库成功。至此,项目经理初始化项目仓库就完成了。员工jackie着手继续开发项目创建员工jackie目录/Users/hujh/Desktop/GitTest2/jackie2.进入员工jackie的目录cd /Users/hujh/Desktop/GitTest2/jackie3.”克隆"代码库到本地$ git clone /Users/hujh/Desktop/GitTest2/GitServer/weibo/就可以在jackie目录下看到项目文件了然后就可以开发项目了。GitHub 教程系列文章: GitHub 使用教程图文详解 http://www.linuxidc.com/Linux/2014-09/106230.htm Git 标签管理详解 http://www.linuxidc.com/Linux/2014-09/106231.htm Git 分支管理详解 http://www.linuxidc.com/Linux/2014-09/106232.htm Git 远程仓库详解 http://www.linuxidc.com/Linux/2014-09/106233.htm Git 本地仓库(Repository)详解 http://www.linuxidc.com/Linux/2014-09/106234.htm Git 服务器搭建与客户端安装 http://www.linuxidc.com/Linux/2014-05/101830.htm Git 概述 http://www.linuxidc.com/Linux/2014-05/101829.htm 分享实用的GitHub 使用教程 http://www.linuxidc.com/Linux/2014-04/100556.htm Ubuntu下Git服务器的搭建与使用指南 http://www.linuxidc.com/Linux/2015-07/120617.htmGit 的详细介绍:请点这里
Git 的下载地址:请点这里本文永久更新链接地址