聊城那里有做网站,html5个性个人网站,wordpress添加产品产品列表,渭南市工程项目网上审批大厅Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式版本控制软件#xff0c;它不同于Subversion、CVS这样的集中式版本控制系统。在集中式版本控制系统中只有一个仓 库#xff08;repository#xff09;#xff0c;许多个工作目录#xff08…Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式版本控制软件它不同于Subversion、CVS这样的集中式版本控制系统。在集中式版本控制系统中只有一个仓 库repository许多个工作目录working copy而像Git这样的分布式版本控制系统中其他主要的分布式版本控制系统还有 BitKeeper 、 Mercurial 、 GNU Arch 、 Bazaar 、Darcs 、 SVK 、 Monotone 等每一个工作目录都包含一个完整仓库它们可以支持离线工作本地提交可以稍后提交到服务器上。分布式系统理论上也比集中式的单服务器系统更健壮单服务器系统一旦服务器出现问题整个系统就不能运行了分布式系统通常不会因为一两个节点而受到影响 。 因为Android是由kernel、Dalvik、Bionic、prebuilt、build等多个Git项目组成所以Android项目编写了一个名为Repo的Python的脚本来统一管理这些项目的仓库使得Git的使用更加简单。 From the detail of android Git repositories,see https://android.googlesource.com/ A. 1.Install GIT. Download and install GIT for your development system. GIT 1.7.11.2 for Windows. 2.Install Repo. Google Official Doc:http://source.android.com/source/downloading.html Download and setup the repo tool, as described on the Android open source project site. Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Version Control.] Note: Developers using Windows must use a Linux compatibility package, such as cygwin, to install and run repo. Within your compatibility environment, you must install curl, git and python to be able to download and use the repo tool. To install:first ensure the bin folder in your current users root directory(Create it if none.If you dont know where to create bin folder,you can try cd ~/bin and check the hint.my is c/User/aa/bin)then add (~/bin) to the PATH environment variables,download Repo by curl and save it to ~/bin/repo. curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo ~/bin/repo You can also download it manually,and put it in the appointed folder.Just need to open the address in browser https://dl-ssl.google.com/dl/googlesource/git-repo/repo. If the link if out of date,go to google official site to update it.(http://source.android.com/source/downloading.html) Ensure it has executable access: chmod ax ~/bin/repo 3.Initialize Repository. If you want the lastest main source code,you need repo.Create a directory first,for example,~/android,enter and repo init. repo init -u git://android.git.kernel.org/platform/manifest.git If you want a branch instead of main,you need -b to specify the branch name: repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake repo init -u http://android.git.kernel.org/platform/manifest.git -b cupcake Use git branch to list all the branch. However,an error occurs when I use it: It need the python interpreter.Now I run it in Git Bash.I switch to Cygwin Terminal and add a new environment variable C:\Users\aa\bin.Then it works well. unable to connect to android.git.kernel.org may also occurs.It is because there are too many servers which provider downloads at port:80.You need to replace the git with http: It may takes a long time,depends on you internet.You will see repo initialized in /android at last. About the email and name ,you can set it by: git config --global user.email [emailxxxxxxxxxxxx]xxxxxxxxxxxx[/email]
git config --global user.name xxxxxx 4.Synchronization(download) Modify file .repo/manifests/default.xml,replace the fetchgit://android.git.kernel.org/ with fetchhttp://android.git.kernel.org/.(I skip this step.) repo sync repo sync project1 project2 … 如果是同步Android中的单个项目只要在项目目录下执行简单的 git pull 即可。 B. If you just need the code of some project,like kernel/common. Use Git directly。 git clone git://android.git.kernel.org/kernel/common.git In the consideration of the whole download of Linux Kernel,it may take a long time also. 如果需要某个branch的代码用git checkout即可。比如我们刚刚拿了kernel/common.get的代码那就先进入到common目录然后用下面的命令 git checkout origin/android-goldfish-2.6.27 -b goldfish 这样我们就在本地建立了一个名为goldfish的android-goldfish-2.6.27分支代码则已经与android-goldgish-2.6.27同步。我们可以通过git branch来列出本地的所有分支。 C. 通过GitWeb下载代码 另外如果只是需要主线上某个项目的代码也可以通过 GitWeb 下载在shortlog利用关键字来搜索特定的版本或者找几个比较新的tag来下载还是很容易的。 Git最初是为Linux内核开发而设计所以对其他平台的支持并不好尤其是Windows平台必须要有Cygwin才可以。现在得益于 msysgit 项目我们已经可以不需要Cygwin而使用Git了。另外 Git Extensions 是一个非常好用的Windows Shell扩展它能与资源管理器紧密集成甚至提供了Visual Studio插件。它的官方网站上有一分不错的 说明文档 感兴趣的朋友可以看一看。 至于Git的参考文档我推荐 Git Magic 这里还有一个 Git Magic的中文版 。 获取Anroid Linux Kernel过程 [rootlocalhost ~]# mkdir bin [rootlocalhost ~]# curl http://android.git.kernel.org/repo ~/bin/repo [rootlocalhost bin]# cd bin/ [rootlocalhost bin]# chmod ax ~/bin/repo [rootlocalhost bin]# cd /usr/local/src/ [rootlocalhost src]# mkdir project-android [rootlocalhost src]# cd project-android/ [rootlocalhost project-android]# git clone git://android.git.kernel.org/kernel/common.git 这里会下载半天下载完成之后 [rootlocalhost src]# cd common [rootlocalhost common]# lsarch CREDITS drivers include Kbuild MAINTAINERS net samples soundblock crypto firmware init kernel Makefile README scripts usrCOPYING Documentation fs ipc lib mm REPORTING-BUGS security virt [rootlocalhost common]# git branch -a* android-2.6.27diffremotes/origin/HEAD - origin/android-2.6.27 remotes/origin/android-2.6.25remotes/origin/android-2.6.27remotes/origin/android-2.6.29remotes/origin/android-goldfish-2.6.27remotes/origin/android-goldfish-2.6.29 D. 通过第三方repo下载代码 在获取 Android 源码的第一步就是需要获得 Git 和 Repo在获得 “repo” 的时候就需要到 “kernel.org” 获取 curl http://android.git.kernel.org/repo ~/bin/repo 基于种种原因你是无法同步的会提示 % Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (7) couldnt connect to host 即使你之前已经获取了 “repo”而你在同步 Android 源码时候也会提示 android.git.kernel.org[0: 130.239.17.13]: errnoConnection refused
android.git.kernel.org[0: 199.6.1.173]: errnoConnection refused
android.git.kernel.org[0: 2001:6b0:e:4017:1972:112:1:0]: errnoNetwork is unreachable
android.git.kernel.org[0: 2001:500:60:10:1972:112:1:0]: errnoNetwork is unreachable
fatal: unable to connect a socket (Network is unreachable)
error: Cannot fetch platform/bionic 故本文这里就使用另外源来取得 Android 源码。 一、获取 repo 这个是老外自己建立的使用这个源可以获得 repo但是后续的源码也是使用老外自己建立的。首先获取 repo curl http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo ~/bin/repo 给 “repo” 增加相应权限chmod ax ~/bin/repo 添加环境变量PATH~/bin:$PATH 这样就获取了第三方的 repo。 二、同步 Android 源码 同样是使用老外自己的源首先进入工作目录cd ~/android/system/ repo init -u git://codeaurora.org/platform/manifest.git可以查看所有分支 同步源码repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread 查看分支时注意只有[New Branch]的才可以下载[New Tag]的无法下载。 开始同步repo sync 这个是第三方的源码不知道其中会不会有什么问题我自己也同步了。请大家自己斟酌这里仅仅是提供一种方法。 For Detail:http://source.android.com/source/downloading.html转载于:https://www.cnblogs.com/qiengo/archive/2012/07/19/2598764.html