我需要使用用户和密码向Git传递参数,如下面的示例所示。
注一:
WA不能使用
git config --global credential.helper 'cache --timeout=1800'
例如。
注二:
分支机构
[BRANCH_NAME]
必须设置为跟踪远程分支
[分行名称]
从
origin
.
#!/bin/bash
USR_CREDENTIALS="https://[USER_NAME]:[PASSWORD]@[GIT_URL]/PROJECT.git"
BRANCH_NAME="[BRANCH_NAME]"
git fetch $USR_CREDENTIALS --all --prune
# ERROR: fatal: fetch --all does not take a repository argument
git checkout -b $BRANCH_NAME origin/$BRANCH_NAME
# ERROR: fatal: 'origin/[BRANCH_NAME]' is not a commit and a branch '[BRANCH_NAME]' cannot be created from it
我在上面的代码中犯了什么错误?有什么解决办法吗?