代码管理工具git端遇到的问题

来源:互联网 发布:linux proc 内存 编辑:程序博客网 时间:2024/06/08 10:30

1.checkout代码出错

Last login: Tue May  9 14:14:42 on ttys003

tdeMacBook-Pro:~ longjun$ ls

Applications DownloadsMusic gitkeyfilersacert.csr

Desktop LibraryPictures gitkeyfile.pub

Documents MoviesPublic private.pem

tdeMacBook-Pro:~ longjun$ git clone git@xxxxx.git

Cloning into 'xxx'...

remote: Counting objects: 5572, done.

error: pack-objects died of signal 9855/4261)   

error: git upload-pack: git-pack-objects died with error.

fatal: git upload-pack: aborting due to possible repository corruption on the remote side.

remote: aborting due to possible repository corruption on the remote side.

fatal: early EOF

fatal: index-pack failed

tdeMacBook-Pro:~ longjun$ git clone --depth=1 git@xxxxxx.git

Cloning into xxx...

remote: Counting objects: 4857, done.

remote: Compressing objects: 100% (3623/3623), done.

remote: Total 4857 (delta 1216), reused 4777(delta 1189)

Receiving objects: 100% (4857/4857), 327.85 MiB | 133.00 KiB/s, done.

Resolving deltas: 100% (1216/1216), done.

error: Untracked working tree file '.DS_Store' would be overwritten by merge.

fatal: unable to checkout working tree

warning: Clone succeeded, but checkout failed.

You can inspect what was checked out with 'git status'

and retry the checkout with 'git checkout -f HEAD'


tdeMacBook-Pro:~ longjun$ ls

Applications DownloadsMusic gitkeyfilersacert.csr

Desktop LibraryPictures gitkeyfile.pub

Documents MoviesPublic private.pem

tdeMacBook-Pro:~ longjun$ ls

Applications DownloadsMusic gitkeyfileprivate.pem

Desktop LibraryPictures gitkeyfile.pubrsacert.csr

Documents MoviesPublic xxx

tdeMacBook-Pro:~ longjun$ cd leve_ios/

tdeMacBook-Pro:xxx longjun$ ls

tdeMacBook-Pro:xxx longjun$ ls -al

total 16

drwxr-xr-x   4 longjun  staff   136  5  9 14:47 .

drwxr-xr-x+ 35 longjun  staff  1190  5  9 15:33 ..

-rw-r--r--@  1 longjun  staff  6148  5  9 15:11 .DS_Store

drwxr-xr-x  16 longjun  staff   544  5  9 15:28 .git

tdeMacBook-Pro:xxx longjun$ cd .git/

tdeMacBook-Pro:.git longjun$ ls

FETCH_HEAD hooksrefs

HEAD info shallow

branches logs sourcetreeconfig

config objects

description packed-refs

tdeMacBook-Pro:.git longjun$ cd ..

tdeMacBook-Pro:xxx longjun$ ls

tdeMacBook-Pro:xxx longjun$ git pull

Already up-to-date.

tdeMacBook-Pro:xxx longjun$ git log

commit d4853960dc448aa0874d67b7dddf7501186ffcd9

Author: xxxxx

Date:   Sun May 7 09:29:44 2017 +0800


    no message


commit b0123d7a491bd79d642eb11449cb5cb8a55c48d1

Author: xxxxxx

Date:   Sat May 6 16:21:56 2017 +0800


    修改

tdeMacBook-Pro:xxx longjun$ git checkout d4853960dc448aa0874d67b7dddf7501186ffcd9

Checking out files: 100% (4196/4196), done.

Note: checking out 'd4853960dc448aa0874d67b7dddf7501186ffcd9'.


You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.


If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:


  git checkout -b <new-branch-name>


HEAD is now at d485396... no message

tdeMacBook-Pro:xxx longjun$ ls

Podfile iphoneLiveiphoneLiveUITests

Podfile.lock iphoneLive.xcodeprojnew.txt

Pods iphoneLive.xcworkspace

c.sh iphoneLiveTests

tdeMacBook-Pro:xxx longjun$ 


2.终端拉取代码,拉取失败:另附原因


只拉取最新版本

因为要clone的代码多达45G,在加上里面的分支以及历史太多,因此直接用git clone 命令去克隆的时候经常导致服务端内存爆满,clone不下来。如果不需要去关注以前的版本,可以只clone最新的版本,使用如下命令:

git clone --depth=1 git://serverRepo myRepo

这样就只拉取默认分支的最新版本。如果想获取某个具体的分支,可以使用branch命令,拉取某个分支的最新版本代码,比如要获取release/1.6.0分支的代码 :

git clone -b release/1.6.0 --depth=1 git://serverRepo myRepo

fatal: The remote end hung up unexpectedly

clone分支的时候可能会失败,比如early EOF

pastedGraphic.png

3.clone失败

解决的办法是使用ssh协议去clone,而不是http协议。


代码提交通过三方工具软件:SourceTree

sourceTree推送失败

git fetch --unshallow


mac SourceTree 配置代码比较工具 Beyond Compare

 在这里Beyond Compare简称BC

    最新版本的 SourceTree在偏好设置->Diff->对比工具中支持选择 BC 工具,但是总是弹出错误提示:

"命令行实用程序bcomp没有在你的系统上找到。请确保您安装的命令行工具为您选择选项。"

pastedGraphic_1.png

    出现这个问题的原因是在安装BC的时候没有安装命令行工具

第一步:文件夹->前往->前往文件夹->/usr/local/bin

    在这个目录下如果确实没有一个快捷方式bcomp,表示确实是没有安装命令行工具,我们只需要打开BC,安装命令行工具即可

第二部:打开BC,安装命令行工具

   

pastedGraphic_2.png

pastedGraphic_3.png

第三步:配置SourceTree比较工具

    SourceTree->偏好设置->Diff->对比工具,在下拉列表中选择BC即可

pastedGraphic_4.png


现象:

pastedGraphic_5.png

Mac下查看Git的全局忽略列表

打开Finder,选择前往->前往文件夹

输入~/.gitignore_global查看git所有的忽略文件,右键用记事本打开即可,将需要显示的文件类型,在该打开的文件中删除,如:xcode新增文件时,.h文件有A的标识而.m文件没有A的标识,这时打开git所有的忽略文件中,将*.m删除,保存,关闭文件,重新打开xcode和代码管理工具sourceTree(或其它代码管理工具),重新新建文件,即可看到.m文件也有A的标识,且代码管理工具在提交代码时,.m文件也会有

*.m


原创粉丝点击