added git_cred function which adds the credential helper to the git config
This commit is contained in:
@@ -289,3 +289,21 @@ if test -e /usr/bin/dd
|
||||
sudo dd if=$argv[1] of=$argv[2] bs=4M status=progress oflag=sync
|
||||
end
|
||||
end
|
||||
|
||||
################ GIT ##########################################################
|
||||
|
||||
function git_cred
|
||||
if test -f .git/config
|
||||
# Check if the credential helper is already in the file
|
||||
if grep -q "git-honney333-work-cred" .git/config
|
||||
echo "Credential helper is already configured in .git/config"
|
||||
else
|
||||
echo "Adding Password tool to git"
|
||||
# Append the blocks with a clean newline separator
|
||||
echo -e "\n[credential]\n helper = !"$HOME"/.bin/git-honney333-work-cred" >> .git/config
|
||||
end
|
||||
else
|
||||
echo "no .git/config file"
|
||||
echo "could not add the credentials helper"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user