使用 git 命令行工具创建一个 Android 工程

来源:互联网 发布:数据流量怎么打开不了 编辑:程序博客网 时间:2024/05/01 00:47

这里写图片描述

  • workspace: 本地的工作空间。

  • index:缓存区域,临时保存本地改动。

  • local repository: 本地仓库,指向最后一次提交HEAD。

  • remote repository:远程仓库。

新建仓库

新建仓库

new Repository

Create a new repository


安装 Git


  • Window 安装
    Git for Windows、TortoiseGit,或安装类 UNIX 模拟环境 Cygwin。
  • Linux
$ yum install git-core  #在 redhat 等系统下用 yum$ apt-get install git-core  #在 debian, ubuntu 等系统下用 apt-get
  • Mac OS
方法一:homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"     # Install Homebrew (OS X 10.10 or higher)$ brew install git
方法二:AppStore 安装 Xcode,Xcode 集成了 Git

“Xcode”–>“Preferences”–>“Downloads”–>“Command Line Tools”–>“Install”

  • 验证
$ git --version

测试 Git

SSH 配置:

$ ssh-keygen -t rsa -C "user.email" # 生成秘钥
  • 这里不要设置密码,直接按回车就可以,以后更新就不需要密码

生成秘钥

windows 系统在目录 C:\Users\用户名.ssh

复制 ~/.shh/.is_rsa.pub 内容到

Account Settings —> SSH Public keys —> add another public keys

测试连接

Windows 7下 Git SSH 创建 Key 的步骤 | 星空武哥


从远程仓库克隆一个版本库

git-clone

新建 Android 项目

新建 Android 项目

查看项目结构

查看项目结构

查看仓库当前状态并将文件改动提交到缓存区域

git add .;git status

git commit

git push

An-Android-Project


附:

CSDN
Web IDE

码云

Bitbucket


Git GUI Tools

GitHub Desktop.

Source Tree.

作者:李柿贤;原文地址

0 0
原创粉丝点击