背景:
在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
分享到:
相关推荐
问题描述: 在使用git 进行提交时, 出现上面这个报错, 导致无法提交. 报错大致意思就是创建index.lock文件失败,因为已经存在index.lock文件了. index.lock文件是在.git下面, 而.git是一般是隐藏的, 那么可以通过以下...
解决fatal:remote error:You can’t push to git://github.com/username/*.git问题的办法 今天Git push的时候 fatal:remote error: You can't push to git://github.com/username/*.git Use git@github....
18年7月更新,清华镜像,完美解决 Yocto,Android fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle 错误,绕开GFW
fatal: unable to connect to aosp.tuna.tsinghua.edu.cn: aosp.tuna.tsinghua.edu.cn[0: 166.111.206.63]: errno=Connection refused aosp.tuna.tsinghua.edu.cn[1: 2001:da8:20f:3101:5054:ff:feb1:be95]: errno=...
系统环境:CentOS Linux release 7.6.1810 (Core) 起因:npm构建时报错 ... fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out npm
coreutils:https:git.savannah.gnu.orggitcoreutils.git
第一步 重新生成ssh ssh-keygen -t rsa -C “这里需要填写邮箱。我填写的是我的绑定主邮箱。我想其他邮箱也是可以的,只不过我没有测试。” 第二步 查看你生成的公钥 cat ~/.ssh/id_rsa.pub 然后我们就可以看到我们...
主要介绍了解决fatal:remote error:You can't push to git://github.com/username/*.git问题的办法的相关资料,需要的朋友可以参考下
主要介绍了解决Unable to access 'https://gitee.com/自己的项目/': Could not resolve host: gitee.com问题,需要的朋友可以参考下
git init xxxx的时候报错: fatal: git 1.7.2 or later required 或许是git版本太低,你可以自己编译最新git源码进行安装。
解决git clone时报错问题:sign_and_send_pubkey: signing failed: agent refused operation
系统环境:CentOS Linux release 7.6.1810 (Core) 起因:npm构建时报错 ... fatal: unable to access 'https://github.com/nhn/raphael.git/': Failed connect to github.com:443; Connection timed out npm
File Not found 'DesignIntf.dcu'在D7下的解决方法 在LIABRAY中加入TOOLAPI的安装路径
fatal error: boostdesc_bgm.i: No such file or directory补充文件
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn...
树莓派4B需要新的版本WiringPi, 安装wiringPi连接失败解决方法
torch 项目完整代码,公司无法使用git,所以放了个备份在csdn上 (git clone https://github.com/torch/distro.git ~/torch --recursive)
解决caffe在make时出现如下错误: src/caffe/util/io.cpp:17:10: fatal error: turbojpeg.h: 没有那个文件或目录 #include <turbojpeg.h> ^~~~~~~~~~~~~ compilation terminated. Makefile:610: recipe for target...
win10安装git报错 fatal:open /dev/null or dup failed: No such file or directory错误,将该文件复制到C:\Windows\System32\drivers 替换掉原有的null.sys文件重启即可
iOS SDK很早就支持了SQLite,在使用时,只需要加入 libsqlite3.dylib 依赖以及引入 sqlite3.h 头文件即可。但是,原生的SQLite API在使用上相当不友好,在使用时,非常不便。于是,开源社区中就出现了一系列将SQLite...