-
我在git中创建了一个个人访问令牌,并将其存储在Linux虚拟机GIT_ACCESS_TOKEN环境变量
-
我克隆了一个我拥有的github repo到VM。这个repo包含一个子模块。
-
我运行
git submodule init
返回:$ git submodule init Submodule '<path>' (https://${GIT_ACCESS_TOKEN}@github.com/<user>/<repo>.git) registered for path '<path>'
-
我运行
git submodule update --recursive
,它挂在$ git submodule update Cloning into '<my_path>'...
-
如果我只是克隆这样的东西:
https://${GIT_ACCESS_TOKEN}@github.com/<user>/<repo>.git
克隆作品 -
我在raspberry pi和Raspbian上尝试了相同的过程,并且得到了步骤4:
Cloning into '<my_path>'... Password for 'https://${GIT_ACCESS_TOKEN}@github.com': remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: Authentication failed for 'https://github.com/<user>/<repo>/' fatal: clone of 'https://${GIT_ACCESS_TOKEN}@github.com/<user>/<repo>' into submodule path '<my_path>' failed Failed to clone '<my_path>'. Retry scheduled
-
我再次在树莓派上尝试步骤5,克隆继续进行正确。
有人见过这种行为吗?什么好主意吗?提前谢谢。
Per https://git-scm.com/docs/gitcredentials "Git有时需要用户的凭据才能执行操作;例如,为了通过HTTP.....">
访问远程存储库,它可能需要请求用户名和密码。在本例中,将环境变量GIT_ASKPASS设置为返回GIT_ACCESS_TOKEN的函数。例如:export GIT_ASKPASS=$HOME/path/to/git_askpass.sh
地点:
git_askpass.sh:
#!/bin/bash
echo $GIT_ACCESS_TOKEN```