gpt4 book ai didi

git - gerrit-cherry-pick :fatal: 'origin' does not appear to be a git repository

转载 作者:太空狗 更新时间:2023-10-29 14:21:50 25 4
gpt4 key购买 nike

我在尝试执行 gerrit-cherry-pick 时遇到以下错误,我执行了 git remote -v 并且可以看到 origin 指向 ssh://waccount@tech-gerrit.sd.company.com:29418/tech-ci.git ,任何人都可以提供有关为什么会出现此错误的指导吗?如何进一步调试并修复它?

2018-08-09 21:13:15 change-merged   runCmd               169    INFO    : Running command git --git-dir=/gerrit_v2/hooks/tech_projects/tech-ci/.git --work-tree=/gerrit_v2/hooks/tech_projects/tech-ci remote -v
2018-08-09 21:13:15 change-merged runCmd 173 INFO :
origin ssh://waccount@tech-gerrit.sd.company.com:29418/tech-ci.git (fetch)
origin ssh://waccount@tech-gerrit.sd.company.com:29418/tech-ci.git (push)

2018-08-09 21:13:15 change-merged runCmd2 180 INFO : Running command /gerrit_v2/hooks/gerrit-cherry-pick origin 20633/2
2018-08-09 21:13:15 change-merged runCmd2 187 INFO : fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Gerrit-cherry-pick:

usage() {
echo >&2 "usage: $0 remote changeid..."
echo >&2 "usage: $0 --continue"
echo >&2 "usage: $0 --skip"
echo >&2 "usage: $0 --abort"
echo >&2 "usage: $0 [--close|--replace] remote"
exit 1
}

die() {
echo >&2 "fatal: $1"
exit 1
}

GIT_DIR=$(git rev-parse --git-dir) || exit
CL="$GIT_DIR/GERRIT_CHANGES"
STATE="$GIT_DIR/rebase-gerrit"
TODO="$STATE/todo"

RESOLVEMSG="
When you have resolved this problem run \"$0 --continue\".
If you would prefer to skip this patch, run \"$0 --skip\".
"

pop_action() {
sed -e 1d <"$TODO" >>"$TODO".new
mv -f "$TODO".new "$TODO"
}

mark_done() {
read commit changeid <"$TODO"
changeid=$(get_changeid "$changeid")
head_after=$(git rev-parse HEAD^0)
head_before=$(cat "$STATE/head_before")
if ! test $head_after = $head_before
then
echo $head_after >"$CL/$changeid"
fi
pop_action
}

do_next() {
while test -s "$TODO"
do
read commit changeid <"$TODO"
git rev-parse HEAD^0 >"$STATE/head_before"
git format-patch \
-k --stdout --full-index --ignore-if-in-upstream \
$commit^..$commit |
git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" || exit
mark_done
done

echo >&2 "Done."
rm -rf "$STATE"
}

git_am_opt=
if test -f "$STATE/git_am_opt"
then
git_am_opt=$(cat "$STATE/git_am_opt")
fi

while test $# != 0
do
case "$1" in
--continue)
test -f "$TODO" || die "No cherry-pick in progress?"
git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" --resolved || exit
mark_done
do_next
exit
;;
--skip)
test -f "$TODO" || die "No cherry-pick in progress?"
git reset --hard HEAD || exit
git am --skip || exit
pop_action
do_next
exit
;;
--abort)
test -f "$TODO" || die "No cherry-pick in progress?"
git reset --hard HEAD
git am --skip
rm -rf "$STATE"
;;
--close|--replace)
shift
test -d "$CL" || die "No changes to close"
test $# = 1 || usage
remote=$1
printf %s "git push $remote" >&2
rs=$(cd "$CL" && for change_id in *; do
test "$change_id" = '*' && die "No changes to close"
c=$(cat "$change_id");
echo "$c:refs/changes/$change_id";
echo ' \' >&2;
printf %s " $c:refs/changes/$change_id" >&2
done)
echo >&2
echo >&2
git push $remote $rs
rc=$?
test $rc = 0 && rm -rf "$CL"
exit $rc
;;
--whitespace=*)
git_am_opt="$git_am_opt $1"
;;
--committer-date-is-author-date|--ignore-date)
git_am_opt="$git_am_opt $1"
;;
-C*)
git_am_opt="$git_am_opt $1"
;;
-s|--signoff)
git_am_opt="$git_am_opt $1"
;;
-*)
usage
;;
*)
break
;;
esac
shift
done

get_changeid() {
case $1 in
*/*) echo ${1%%/*} ;;
*) echo $1 ;;
esac
}

to_ref() {
case $1 in
*/*)
change_id=${1%%/*}
patchset_id=${1##*/}
;;
*)
change_id=$1
patchset_id=1
;;
esac

hash=$(($change_id % 100))
case $hash in
[0-9]) hash="0$hash" ;;
esac

echo "refs/changes/$hash/$change_id/$patchset_id"
}

get_revid() {
grep $(to_ref $1) <"$GIT_DIR/FETCH_HEAD" | cut -f1
}

# Initialize state
#
test $# -lt 2 && usage
remote="$1"
shift

mkdir "$STATE" || die "cherry-pick already in progress"
echo $git_am_opt >"$STATE/git_am_opt"

if ! git fetch $remote $(for id; do to_ref $id; done)
then
rm -rf $STATE
exit 1
fi

(for id
do
if revid=$(get_revid $id)
then
echo "$revid $id"
else
echo >&2 "fatal: $id not found"
exit 1
fi
done) >"$TODO"

mkdir -p "$CL"
echo >&2
do_next

最佳答案

这表明执行该命令的用户帐户没有在 ~waccount/.ssh/authorized_keys 中注册的 ~/.ssh/id_rsa.pub 默认公共(public) SSH key > 在 tech-gerrit.sd.company.com 服务器上。

如果可能,尝试在相同的命令序列中执行

ssh -Tv -p 2941 waccount@tech-gerrit.sd.company.com 

这将显示有关失败的连接尝试的更多详细信息。

如果不可能,请尝试并确保环境变量 GIT_SSH_COMMAND 设置为“ssh -v”。

关于git - gerrit-cherry-pick :fatal: 'origin' does not appear to be a git repository,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51779013/

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