gpt4 book ai didi

git 克隆, "checking out files"阶段跳过

转载 作者:太空狗 更新时间:2023-10-29 13:02:43 24 4
gpt4 key购买 nike

ubuntu@site3-user03:/projects$ git clone git://git.alsa-project.org/alsa-driver.git  

进行了。结果如下

Cloning into 'alsa-driver'...
remote: Counting objects: 208801, done.
remote: Compressing objects: 100% (41538/41538), done.
remote: Total 208801 (delta 162528), reused 206283 (delta 160012)
Receiving objects: 100% (208801/208801), 37.00 MiB | 1.53 MiB/s, done.
Resolving deltas: 100% (162528/162528), done.
Checking connectivity... done.
ubuntu@site3-user03:/projects$

但是,由于某些未知原因,克隆过程不包括该阶段 checkout 文件:100% (xyz/zyx),完成。
通常克隆过程包括 check out 工作空间。最后,我的私有(private) fork 有空的工作空间,我必须决定在哪里分支,这可能并不简单。

ubuntu@site3-user03:/projects/alsa-driver$ git ls-remote origin
a1c6fbc1a65d8a755425d0b56077868148512891 HEAD
1721fb542b00f1c7aebc923732068f403b6062ad refs/heads/build
a1c6fbc1a65d8a755425d0b56077868148512891 refs/heads/master
71b3b2b41dfbdeda78e2e7b62fe2afa8b451fb6e refs/heads/mirror
b044dfe04f636d87fd391b575ba41e495e68e973 refs/heads/release
6386d9e39e6f364698648f4e4741897f83b00121 refs/tags/build/v1.0.1
234b00ebe6e1513c3ce8cdd83999c255bd5516eb refs/tags/build/v1.0.10
f888eb06d4c7af89faa2f9dda189d488312ecb07 refs/tags/build/v1.0.10rc1
e4c4d1037521f536b79f8d145979ec869db353f9 refs/tags/build/v1.0.10rc2
....
many more tags

我的期望是克隆基于远程的 HEAD 执行 check out ,它指向远程上的某个提交。
跳过 checkout 阶段的可能原因是什么?
在克隆过程中,我在工作空间中创建了一个小的自述文件。然而,该文件至今仍未被跟踪。没有计划跟踪该文件。
此文件创建是否会干扰克隆过程,因此它无法包含 checkout 阶段?

ubuntu@site3-user03:/projects$ git clone git@git.alsa-project.org:alsa-driver.git alsa-driver  
Cloning into 'alsa-driver'...
The authenticity of host 'git.alsa-project.org (77.48.224.243)' can't be established.
RSA key fingerprint is f1:0e:a7:1f:bc:1b:9f:71:00:85:c9:4a:8a:d9:d6:33.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ubuntu@site3-user03:/projects$

所以,我中止了它,因为我习惯于使用简单的克隆过程,而且对确认在未经身份验证的主机上继续运行的所有结果影响一无所知。

git help clone

以及其中使用以下 URL 格式的示例

 The following syntaxes may be used with them:
· git://host.xz[:port]/path/to/repo.git/
· http[s]://host.xz[:port]/path/to/repo.git/
...
git clone git://git.kernel.org/pub/scm/.../linux.git my-linux
git clone --reference /git/linux.git \
git://git.kernel.org/pub/scm/.../linux.git \
my-linux
· Create a bare repository to publish your changes to the public:
git clone --bare -l /home/proj/.git /pub/scm/proj.git

对于使用的设置,以下也适用:

ubuntu@site3-user03:/$ sudo find / -type f -name known_hosts
[sudo] password for ubuntu:
ubuntu@site3-user03:/$

过去有一次我用其他克隆体也有类似的效果。当时它是 MSM SoC 的 Linux 内核公共(public)存储库的克隆。然而,那个时候克隆过程也产生了一些消息“无法克隆,因为没有在远程找到???”。忘记了什么???读。所以在最终效果中,我还必须在克隆过程之后手动进行 checkout 。然而,在这种情况下并没有出现这样的警告, fork 了 alsa-driver public repo。

最佳答案

我从未见过使用您用来克隆存储库的 URL 格式,因为标准应该是:git://git.alsa-project.org:alsa-driver.git ,使用您使用的格式以裸模式克隆存储库,这就像指定 --bare命令行选项,基本上执行:

Make a bare Git repository. That is, instead of creating <directory> and placing the administrative files in <directory>/.git, make the <directory> itself the $GIT_DIR. This obviously implies the -n because there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.

如果你看一下 documentation of the project您正在尝试克隆您会注意到要克隆您必须的特定项目:

git clone git@git.alsa-project.org:alsa-driver.git alsa-driver
cd alsa-driver
git branch build remotes/origin/build
git branch mirror remotes/origin/mirror
git branch release remotes/origin/release

关于git 克隆, "checking out files"阶段跳过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34413707/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com