从docker容器克隆git仓库

为了让docker访问我的git仓库,我创build了一个个人访问令牌。 并embedded命令

运行git clone -b docker https:// token:x-oauth-basic@github.com:user / repo.git

进入我的dockerfile。 我从1得到

但它是抛出错误:

远程:未find致命的:存储库'https:// {token}:x-oauth-asic@github.com:user / repo.git /'not found

虽然我已经授权访问我的回购。

我GOOGLE了这个问题,有一个选项复制ssh键到容器,但我想使用oauth机制。 但它不工作,请告诉我知道这里出了什么问题。

下面是使用git令牌的格式

git clone https://<token>@github.com/owner/repo.git 

要么

 git clone https://<token>:x-oauth-basic@github.com/owner/repo.git 

您需要指定令牌作为用户名。 你似乎没有这样做。 参考: https : //github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth