Git的 - 致命的:无法获取当前的工作目录? [英] Git - fatal: Could not get current working directory?
问题描述
当我 git的克隆
从回购,我得到的,
When I git clone
from a repo, I get,
致命的:无法获取当前工作目录:没有这样的文件或目录
我该怎么办?我检查了服务器,发现的.git
文件存在。服务器正在运行一个Gitlab实例。我已经配置 SSH
正确的钥匙,我一直在犯和放大器;现在克隆了一会儿没有任何错误,而这一切发生突然的。
What do I do? I have checked the server and found that .git
file exists. The server is running a Gitlab instance. I have configured ssh
properly with the keys, and I've been committing & cloning for a while now without any error, and this happens all of a sudden.
FWIW,我做的 git的克隆
在bash脚本。
FWIW, I'm doing the git clone
in a bash script.
更新
这是我的bash脚本,
This is my bash script,
for repo in $repos
do
git clone $repo /tmp/tmpdir/
# do stuff with /tmp/tmpdir/
rm -rf /tmp/tmpdir/
done
第一个回购
这很好,但是当为
进入第二回购
失败,并给出了上述致命
错误。
for the first repo
it's fine, but when the for
gets into the second repo
it fails and gives the above fatal
error.
推荐答案
我的猜测是在你的做的东西
部分的某个地方,你将目录改为的/ tmp / TMPDIR /
,这样在接下来的循环中,当前的工作目录不再存在。解决方法是更改目录的/ tmp /
(或任何地方真的)删除的/ tmp / tmdir /
目录之前
My guess is that somewhere in your do stuff
section you change directory into /tmp/tmpdir/
so that in the next loop, the current working directory no longer exists. The fix is to change directory to /tmp/
(or anywhere really) before removing the /tmp/tmdir/
directory.
这篇关于Git的 - 致命的:无法获取当前的工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!