【问题标题】:Verifying the existence of a file in the terminal验证终端中是否存在文件
【发布时间】:2021-07-23 23:11:19
【问题描述】:

我正在从 GitHub 复制一些代码,但是当我尝试访问其中的文件时,终端输出“没有这样的文件或目录”。

我尝试在计算机上手动查找文件,但确实找不到。

我的猜测是克隆将代码保存在其他地方,当我尝试更改目录时它无法访问它,因为它在计算机中不存在。

这是我在终端中看到的:

fun4all@Fun4AllSingularity:~$ git clone https://github.com/sPHENIX-Collaboration/macros.git
Cloning into 'macros'...
remote: Enumerating objects: 8930, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (179/179), done.
remote: Total 8930 (delta 278), reused 348 (delta 241), pack-reused 8508
Receiving objects: 100% (8930/8930), 1.84 MiB | 1.72 MiB/s, done.
Resolving deltas: 100% (5193/5193), done.
fun4all@Fun4AllSingularity:~$ cd macros/macros/g4simulations/
bash: cd: macros/macros/g4simulations/: No such file or directory

我不确定它是否重要,但我使用的是虚拟盒子,它不在我的本地计算机上。

另外,它以前也有效,最近才开始出现这个问题。

【问题讨论】:

  • 当我查看github.com/sPHENIX-Collaboration/macros 时,也没有macros/g4simulations 文件夹。
  • 一次尝试使用以下命令检查目录树,然后尝试 cd "ls * -r"
  • 但曾经有过。 mdc-3 标签有它们,mdc-4 标签(和更高版本)没有。我不知道我在看什么,所以你必须问他们为什么他们被删除了。

标签: git terminal git-clone nosuchfileexception


【解决方案1】:

g4simulation 目录不再存在于此存储库中。它在一月份在commit 0c6692376c9920588290121ed0174ddeda102e22 中被删除。

可能不再需要它,因为提交的标题是:

抛弃过时的 g4simulation 目录

【讨论】:

    【解决方案2】:

    基于 https://github.com/sPHENIX-Collaboration/macros,当前master 分支中不再存在此文件夹。

    正如 Mureinik 指出的那样,它在不久前被删除了。

    但是,该文件夹仍然存在于旧分支readback_check

    因此,如果您仍想访问该目录 - 无论出于何种原因,您都必须先签出该特定分支。

    cd macros
    git checkout readback_check
    cd macros/g4simulations/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-08
      • 2019-12-26
      • 2014-02-01
      • 2011-01-12
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 2016-11-23
      相关资源
      最近更新 更多