获取Android源码时如何解决【fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not kn
2011-11-11 09:18
691 查看
背景:
在Linux环境下(虚拟机为 VirtualBox)获取Android源代码的时候,
使用命令:repo init -u git://android.git.kernel.org/platform/manifest.git 时提示下列错误:
fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)
机器以及软件环境:
公司内网+代理+VirtualBox+Linux
发生问题的原因:
用一句话来概括就是联网出现问题,因为仅仅在网络设定里面设定代理还不够,我们需要用某种fanqiang工具来实现代理的操作。
根据以上原因重新整理出步骤:
1、安装所需软件:
sudo apt-get install git-core curl
2、设置工具repo的存放目录并将其加入环境变量内:
mkdir ~/bin
PATH=~/bin:$PATH
3、下载repo的脚本并将其模式改为可执行:
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo
4、创建下载源代码的目录
mkdir ~/source
cd ~/source
5、开始repo操作
repo init -u git://android.git.kernel.org/platform/manifest.git
如果是在正常网路不用代理的情况下一般repo都会成功。
但由于公司特殊的网络环境,导致在repo的时候发生fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)的问题。
这个时候可继续以下的步骤能解决这个问题:
-------------------------------------------------------------------------
1、安装corkscrew
sudo apt-get install corkscrew
2、在任意目录建立任意文件
例如: ~/bin/proxy-hoge-user.sh
添加如下内容并保存:
1 #!/bin/bash
2 CORKSCREW=`which corkscrew`
3 $CORKSCREW proxy.hoge.com
8080 $1 $2
~/bin/user-pwd
其中:
proxy.hoge.com为代理的服务器,
8080为代理的端口,
~/bin/user-pwd为存放代理的用户名和密码的文件。
需要根据自己的情况进行设定。
3、新建存放代理的用户名和密码的文件
~/bin/user-pwd
格式为
<username>:<password>
例如 user:pwd
4、改文件属性
chmod 755 ~/bin/proxy-hoge-user.sh
chmod 600 ~/bin/user-pwd
5、添加环境变量GIT_PROXY_COMMAND
sudo vi ~/.bashrc
添加如下命令:
export GIT_PROXY_COMMAND=~/bin/proxy-hoge-user.sh
保存退出。
source ~/.bashrc
在Linux环境下(虚拟机为 VirtualBox)获取Android源代码的时候,
使用命令:repo init -u git://android.git.kernel.org/platform/manifest.git 时提示下列错误:
fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)
机器以及软件环境:
公司内网+代理+VirtualBox+Linux
发生问题的原因:
用一句话来概括就是联网出现问题,因为仅仅在网络设定里面设定代理还不够,我们需要用某种fanqiang工具来实现代理的操作。
根据以上原因重新整理出步骤:
1、安装所需软件:
sudo apt-get install git-core curl
2、设置工具repo的存放目录并将其加入环境变量内:
mkdir ~/bin
PATH=~/bin:$PATH
3、下载repo的脚本并将其模式改为可执行:
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo
4、创建下载源代码的目录
mkdir ~/source
cd ~/source
5、开始repo操作
repo init -u git://android.git.kernel.org/platform/manifest.git
如果是在正常网路不用代理的情况下一般repo都会成功。
但由于公司特殊的网络环境,导致在repo的时候发生fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)的问题。
这个时候可继续以下的步骤能解决这个问题:
-------------------------------------------------------------------------
1、安装corkscrew
sudo apt-get install corkscrew
2、在任意目录建立任意文件
例如: ~/bin/proxy-hoge-user.sh
添加如下内容并保存:
1 #!/bin/bash
2 CORKSCREW=`which corkscrew`
3 $CORKSCREW proxy.hoge.com
8080 $1 $2
~/bin/user-pwd
其中:
proxy.hoge.com为代理的服务器,
8080为代理的端口,
~/bin/user-pwd为存放代理的用户名和密码的文件。
需要根据自己的情况进行设定。
3、新建存放代理的用户名和密码的文件
~/bin/user-pwd
格式为
<username>:<password>
例如 user:pwd
4、改文件属性
chmod 755 ~/bin/proxy-hoge-user.sh
chmod 600 ~/bin/user-pwd
5、添加环境变量GIT_PROXY_COMMAND
sudo vi ~/.bashrc
添加如下命令:
export GIT_PROXY_COMMAND=~/bin/proxy-hoge-user.sh
保存退出。
source ~/.bashrc
相关文章推荐
- 获取Android源码时如何解决【fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)】的问题
- Github error – fatal: Unable to look up github.com (port 9418) (Name or service not known)
- Github error – fatal: Unable to look up github.com (port 9418) (Name or service not known)
- repo sync: fatal: unable to connect to android.git.kernel.org
- ssh: Could not resolve hostname github.com: Name or service not known; fatal: The remote end hung up
- Unable to resolve address ' ' service ' ': Name or service not known
- Unable to resolve address ' ' service ' ': Name or service not known
- Resolving www.linuxde.net... failed: Name or service not known. wget: unable to resolve host address
- apache启动失败:Name or service not known: mod_unique_id: unable to find IPv4 address of "narkii"
- git错误--ssh: Could not resolve hostname ssh.github.com: Name or service not known--解决方式
- )Name or service not known: mod_unique_id: unable to find IPv4 addr ess of "wb_three_cgi20"
- fatal: Not a git repository (or any parent up to mount parent /media) Stopping at filesystem boundar
- git错误--ssh: Could not resolve hostname ssh.github.com: Name or service not known--解决方式
- 下载Android源码 curl: (6) Couldn't resolve host 'android.git.kernel.org' 国内解决办法
- Unable to resolve address ' ' service ' ': Name or service not known
- Selenium2学习-038-firefox、webdriver版本不对称问题解决:org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055
- 如何解决The type or namespace name 'ScriptService' could not be found (are you missing a using directive or an assembly reference?)
- Git配置非22端口,解决:ssh: connect to host xxx port 22: Connection timed out fatal: The remote end hung up unexpectedly
- Android酱油笔记之关于AlertDialog的Unable to add window token null is not for an application解决办法
- mac 配置 ssh 到git (Could not resolve hostname github.com, Failed to connect to github.com port 443 Operation timed out)