try using git command line to set token
parent
30e1ce1ae9
commit
c7a8cf761d
|
|
@ -1,42 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set_config_home() {
|
||||
if [ -z "${XDG_CONFIG_HOME}" ]
|
||||
then
|
||||
mkdir -p "${HOME}/.config"
|
||||
export XDG_CONFIG_HOME="${HOME}/.config"
|
||||
fi
|
||||
|
||||
mkdir -p "${XDG_CONFIG_HOME}/git"
|
||||
|
||||
}
|
||||
|
||||
configure_git_credentials() {
|
||||
echo "${GIT_CREDENTIAL}" >> "${XDG_CONFIG_HOME}/git/credentials"
|
||||
chmod 0600 "${XDG_CONFIG_HOME}/git/credentials"
|
||||
|
||||
git config --global credential.helper store
|
||||
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
|
||||
git config --global --add url.https://github.com/.insteadOf git@github.com
|
||||
}
|
||||
|
||||
if [ -z "${GIT_CREDENTIAL}" ]
|
||||
then
|
||||
echo "GIT_CREDENTIAL unset skipping"
|
||||
else
|
||||
echo "GIT_CREDENTIAL is set configuring git credentials"
|
||||
set_config_home
|
||||
configure_git_credentials
|
||||
|
||||
git config --global credential.helper store
|
||||
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
|
||||
git config --global --add url.https://github.com/.insteadOf git@github.com
|
||||
|
||||
git config --global url."https://ssh:$GIT_CREDENTIAL@github.com/".insteadOf "ssh://git@github.com/"
|
||||
git config --global url."https://git:$GIT_CREDENTIAL@github.com/".insteadOf "git@github.com:"
|
||||
|
||||
echo "-------- git credentials ------------"
|
||||
cat "${XDG_CONFIG_HOME}/.config/git/credentials"
|
||||
fi
|
||||
|
||||
|
||||
echo "-------- git credentials ------------"
|
||||
cat "${XDG_CONFIG_HOME}/.config/git/credentials"
|
||||
|
||||
echo "---------- git config --list -------------"
|
||||
git config --list
|
||||
|
||||
|
||||
echo "---------- git config --list --show-origin -------------"
|
||||
git config --list --show-origin
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue