---
title: "git clone代码断点续传解决办法"
author: "tiwson"
date: "2017-01-11T23:10:27Z"
tags: []
categories: ["开源软件"]
slug: "git-clone"
draft: false
lastmod: "2017-01-11T23:10:27Z"
id: 2352531
url: "https://itspace.iteye.com/blog/2352531"
---

下载android内核源码时，需要用到git，由于git clone不支持断点续传，下载变得很郁闷。解决办法还是有的（前提需要F  翻  Q  墙）：

下面以下载android内核goldfish 3.10源码为例，进行讲解：

          1.   mkdir  android-kernel    # 新建一个android-kernel目录

          2.   cd  android-kernel     # 打开该目录

          3.   git  init        #  先用git  init 新建一个新仓库

 

 

          4.   git fetch https://android.googlesource.com/kernel/goldfish.git  android-goldfish-3.10 

 

注意：#这里需要说明一下https://android.googlesource.com/kernel/goldfish.git这个是goldfish源码地址，而android-goldfish-3.10是goldfish源码版本（具体版本可以打开源码地址查看，前提要先F  翻  Q  墙），注意不要用master，里面为空的，不知为何。

 

如果中途断掉了，可以重复下面的命令继续：

 

         git fetch https://android.googlesource.com/kernel/goldfish.git  android-goldfish-3.10

 

 

直到fetch完毕后，出现以下字样

 

From https://android.googlesource.com/kernel/goldfish.git

 

\*branch           HEAD                -&gt; FETCH\_HEAD

 

意思是把最新的数据fetch到了本地的FETCH\_HEAD分支上去了

 

然后用git checkout FETCH\_HEAD

 

或者也等同于git fetch https://android.googlesource.com/kernel/goldfish.git HEAD

 

 

 

                  如果有错误的地方，欢迎指正和提问！