有没有办法动态更改credential.helper的输出?

2024-06-07 13:48:22 发布

您现在位置:Python中文网/ 问答频道 /正文

是否有一个bash命令可以动态更改Git的credential.helper存储凭据的位置

例如,如果我说:

echo "url=https://USER:PASSWORD@github.com/OWNER/REPO.git" | git credential approve

如果我希望凭证存储在一个名为“github”的文件中,但是

echo "url=https://USER:PASSWORD@gitlab.com/OWNER/REPO.git" | git credential approve

将凭证存储在名为“gitlab”的文件中

有没有一种方法可以动态地做到这一点? 我知道我可以在每次操作之前git config --global credential.helper 'store --file ~/.{appropriateFile}',但实际上我并不想更改服务器的.gitconfig。太多的东西不是我的

另外,作为一个额外的问题,是否有一种方法将这两个命令连接在一起? i、 e

echo git approve credential | -some way of changing the credential storage without editing .config-

Tags: httpsgit命令echogithubhelpercomurl

热门问题