git常见报错

git常见报错

repo sync 报错:

1.连接超时引起报错

现象:

Fetching projects: 59% (128/216)
Initializing project test/platform/ndk …
fatal: read error: Connection reset by peer
error: Cannot fetch test/platform/ndk

解决方法:出现这种错误是由于服务器连接超时,重新执行repo sync -c即可。

2.本地改动引起报错

现象:

error:build/:test/platform/build
checkout03332d19ded42590d698bf30dba33e087810e5b0

解决方法:先将本地的改动备份,然后回退改动的代码。如下:

cd build
git checkout -f .

3.本地磁盘空间不足引起报错

现象:

Syncing work tree: 58% (126/217)
error: Untracked working tree file ‘.gitignore’ would be overwritten by merge.
prebuilts/clang/linux-x86/host/3.6/libc++.so
fatal: cannot create directory at ‘test/platforms/prebuilts/clang/linux-x86/host/3.6’:
No space left on device

解决方法:本地磁盘没有空间,请整理磁盘

4.服务器仓库损坏引起报错

现象:

Initializing project test/platform/frameworks/base …
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
error: Cannot fetch 8939/platform/frameworks/base

解决方法:请将报错发给管理人员,由管理人员解决。

5.读取本地对象报错

现象:

From ssh://192.168.xxx.xxx:xxxx/test/platform/vendor/qcom/proprietary/fastmmi
8fe11c5…353635a test_LA1.0 -> aosp/test_LA1.0
e4dbd8c…04168bf test_spf1.0 -> aosp/test_spf1.0 Fetching projects: 35% (75/214)
fatal: failed to read object c90152c40c79a88814e1cb612d766a67fd883c8d:
Invalid argument
error: Cannot fetch test/platform/vendor/

解决方法:删除本地仓库,重新获取仓库。如下:

rm -rf .repo/projects/android/vendor/test.git
repo sync test/platform/android/vendor/

6.合并报错

现象:

project packages/apps/Settings/
Updating 9efd72b…2ffff10
error: Untracked working tree file ‘res/layout/wifi_wps_dialog.xml’
would be overwritten by merge. Aborting

解决方法:备份出错的文件,然后删除出错的文件,重新执行repo sync。如下:

cd packages/apps/Settings

备份res/layout/wifi_wps_dialog.xml

rm -rf res/layout/wifi_wps_dialog.xml
repo sync test/platform/packages/apps/Settings

7.删除仓库报错

现象:

error: Cannot remove project “external/wpa_supplicant_8”:
uncommitted changes are present

解决方法:这种属于原来在工程中有这个git库,现在不需要这个wpa_supplicant_8这个git库了,但是在删除时却发现这个仓库下有修改的但未提交的东西,确定不需要后手动删除该文件夹,再执行repo sync。如下:

rm -rf external/wpa_supplicant_8
repo sync

8.分支未合并引起报错

现象:

error: frameworks/base/: branch test_LA1.0
is published (but not merged) and is now 10 commits behind

解决方法:在仓库路径下执行git pull来获取最新代码。如下:

cd frameworks/base
git pull aosp test_LA1.0
(远程分支名)**

9.拉取新代码报错

现象:

fatal: ssh://192.168.xxx.xxx:xxxxx/qcom_amss/spf2.0/amss.git/info/refs not found: did you run git update-server-info on the server?
error: Cannot fetch amss
manifest.xml 写的不对,检查仓库名或path路径是否存在,请联系管理人员处理

10.提示找不到xxx.xml

现象:

fatal: manifest ‘aaa.xml’ not availablef
atal: manifest aaa.xml not found

解决方法:

repo init -u ssh://192.168.xxx.xxx:xxxxx/manifest.git –b test -m xxx.xml

检查最后-m 指向对应的project.xml 是否写错

11.找不到manifest

现象:

fatal: ‘/manifests.git’: not a Gerritprojec
tfatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

解决方法:

repo init -u ssh://192.168.xxx.xxx:xxxxx/manifests.git -b test -m xxx.xml

检查manifest是否写错

repo upload报错:

使用repo upload上传代码时,它会对每个仓库进行检查,最后确定出有修改的仓库上传,这样消耗的时间相对比较长。如果你只需要上传几个仓库,可以在修改的仓库目录下执行repo upload -t . (这条命令后面的. 表示仅上传当前目录),这样可以缩短代码上传的时间。-t 参数:发送本地分支名到Gerrit代码评审

另外,也可以使用git push命令来针对单个仓库上传代码,使用命令:
git push aospHEAD:refs/for/branchName

1.公钥或用户名不正确报错

现象:

Upload project kernel/:
branch test_LA1.0 ( 2 commits, Tue Dec 6
14:12:50 2016 +0800):
fcb081ba test_LA1.0 for Poweroff charging
to http://192.168.xxx.xxx:xxxx (y/n)? y
Permission denied (publickey).
fatal: The remote end hung up unexpectedly


[FAILED] kernel/ test_LA1.0 (Upload failed)

解决方法:出现这种permission denied的情况,请查看 gerrit配置说明

2.服务器commit信息丢失引起报错

现象:

error: unpack failed:
error Missing unknown aefde5399a149c4685447fbb9e2375e25a0c69bd
fatal: Unpack error, check server log
To ssh://192.168.xxx.xxx:xxxxx/test/platform/frameworks/base
! [remote rejected] HEAD -> refs/for/test_LA1.0(n/a
(unpacker error))
error: failed to push some refs to
‘ssh://192.168.xxx.xxxx:xxxxx/test/platform/frameworks/base’

解决方法:请将报错发给管理人员,由管理人员解决。

或是用git push 进行提交

git push --no-thin aospHEAD:refs/for/test_LA1.0

3.提示找不到分支名报错

To ssh://192.168.xxx.xxx:xxxxx/test/platform/build
! [remote rejected] HEAD -> refs/for/test_LA1.0 (branch test_LA1.0 not found)
error: failed to push some refs to 'ssh://192.168.xxx.xxx:xxxxx/test/platform/build ’

解决方法:提交代码出现该错误是分支名不正确导致的,检查分支名

4. repo start使用及报错处理

repo start branchname --all (–all参数表示应用于当前工程下所有仓库)。如果对单独某个仓库建分支,可用下面的命令:

cd packages/apps/Mms
repo start branchname .
(注意后面有个点,表示只针对当前目录创建该分支)

git branch branchname(也是针对当前仓库创建分支,但是不会切换到该分支)

注意:用git branch创建的分支,用repo upload 提交不了,只能使用git push命令提交。

5.本地修改引起报错

现象:

error: packages/apps/Settings/: cannot start test

解决方法:备份本地修改的文件,然后将仓库的修改回退,再执行repo start。如下:

git checkout -f
repo start branchname --all

你可能感兴趣的:(git)