在 Yocto 中,如何在非标准端口上通过 ssh 读取 git 存储库

In Yocto, how to read a git repository via ssh on a nonstandard port

我创建了一个包含这些定义的食谱:

SRC_URI = "git://git:<password>@<ip address>:<ssh_port>/home/git/tuxin-repo/project.git;protocol=ssh;branch=test"
SRCREV_default = "5a0b8545d39c97bd9f9628143ed174dabb71f641"

bitbake 以错误结束

ERROR: Fetcher failure: Fetch command failed with exit code 128, output: Cloning into bare repository '/home/yocto/build/downloads/git2/..home.git.tuxin-repo.project.git'... Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,password). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

ERROR: Function failed: Fetcher failure for URL: 'git://git:@:/home/git/tuxin-repo/project.git;protocol=ssh;branch='test''. Unable to fetch URL from any source. ERROR: Logfile of failure stored in: /home/yocto/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/capsystem/1.0-r0/temp/log.do_fetch.7045 ERROR: Task 4 (/home/yocto/sources/poky/../meta-tuxin/recipes-support/project/project.bb, do_fetch) failed with exit code '1'

在命令行中输入密码后,将加载项目。

git clone --branch test ssh://git@<ip_address>:<ssh_port>/home/git/tuxin-repo/project.git

有人可以向我解释我的错误吗?

您必须以这种方式指定 SRC_URI:

SRC_URI = "git://git@<ip address>:<ssh_port>/home/git/tuxin-repo/project.git;protocol=ssh;branch=test"

注意在IP地址前使用git@。作为安全措施,您不能在 SRC_URI 中指定密码。对于自动身份验证,您将不得不使用其他方法,如 .ssh/config