2015-11-18 16:46:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
# these tests rely on GIT_TERMINAL_PROMPT to test properly
|
|
|
|
ensure_git_version_isnt $VERSION_LOWER "2.3.0"
|
|
|
|
|
2016-02-23 20:46:51 +00:00
|
|
|
# if there is a system cred helper we can't run this test
|
|
|
|
# can't disable without changing state outside test & probably don't have permission
|
|
|
|
# this is common on OS X with certain versions of Git installed, default cred helper
|
2016-07-26 15:17:49 +00:00
|
|
|
if [[ -n "$(git config --system credential.helper)" ]]; then
|
2016-02-23 20:46:51 +00:00
|
|
|
echo "skip: $0 (system cred helper we can't disable)"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2015-11-18 16:46:39 +00:00
|
|
|
begin_test "attempt private access without credential helper"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="$(basename "$0" ".sh")"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" without-creds
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
echo "hi" > hi.dat
|
|
|
|
git add hi.dat
|
|
|
|
git add .gitattributes
|
|
|
|
git commit -m "initial commit"
|
|
|
|
|
2016-05-31 21:47:56 +00:00
|
|
|
git config --global credential.helper lfsnoop
|
|
|
|
git config credential.helper lfsnoop
|
|
|
|
git config -l
|
2015-11-18 16:46:39 +00:00
|
|
|
|
2016-07-15 21:38:02 +00:00
|
|
|
git push origin master 2>&1 | tee push.log
|
2016-02-23 20:46:51 +00:00
|
|
|
grep "Authorization error: $GITSERVER/$reponame" push.log ||
|
|
|
|
grep "Git credentials for $GITSERVER/$reponame not found" push.log
|
2015-11-18 16:46:39 +00:00
|
|
|
)
|
|
|
|
end_test
|