mac机配置git满足多种代码管理需求

本文详细介绍了如何在Mac系统上安装并配置Git,包括安装、验证远程登录功能、创建本地代码仓库、使用GitBox提交代码以及配置局域网小团队开发和DropBox作为私人GitHub的方法。

安装git

  • 直接下载git的安装包来进行安装
  • 本身xcode有自带的git功能,可以通过安装xcode命令行工具来在终端运行git命令。 

安装完成后在终端运行命令,会有git版本信息的显示。

clover-macbookpro:~ cloveroger$ git --version
git version 1.7.9.6 (Apple Git-31.1)

配置本地代码仓库

  • 开启mac的远程登陆功能 

  • 新建一个git用户并让这个账户可以被远程登陆 

终端运行命令验证是否git账户可以被远程访问

clover-macbookpro:~ cloveroger$ ssh git@clover-macbookpro.local
The authenticity of host 'clover-macbookpro.local (10.211.55.2)' can't be established.
RSA key fingerprint is 87:80:51:46:98:fa:0f:55:82:8c:76:da:78:92:95:4f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'clover-macbookpro.local,10.211.55.2' (RSA) to the list of known hosts.
Password:
clover-macbookpro:~ git$ ls
Desktop     Downloads   Movies      Pictures
Documents   Library     Music       Public
  • 配置一个git用户下的本地代码仓库

终端运行命令

clover-macbookpro:~ git$ mkdir game_code.git
clover-macbookpro:~ git$ cd game_code.goit/
clover-macbookpro:game_code git$ git init --bare
Initialized empty Git repository in /Users/git/game_code.git/.git/
  • 使用GitBox向上面创建的代码仓库提交代码

弹出的地址栏内填入

git@clover-macbookpro.local:/Users/git/game_code.git
计算机名git仓库代码路径
clover-macbnookpro.local/Users/git/game_code.git

配置局域网小团队开发的代码仓库

局域网选择一台机器作为中心服务器存放代码,设置和本地代码仓库相同。其他局域网上的机器通过修改计算机名为中心服务器的计算机名或者中心服务器的ip地址来对代码仓库进行修改。

配置DropBox变成私人的GitHub

在你的DropBox同步目录下运行本地代码仓库的创建过程,使用GitBox克隆一份地址为/Users/cloveroger/Dropbox/git/game/的代码仓库。该地址所在目录存在于你的DropBox同步目录下。

转载于:https://www.cnblogs.com/lostplesed/archive/2012/08/14/2639116.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值