I have a Push command, that runs this script:
FindGits |
{
while read gitFolder; do
parent=$(dirname $gitFolder);
if [[ `git -C $parent status --porcelain` ]]; then
echo;
(
echo $parent;
git -C $parent status --porcelain
git -C $parent add .
git -C $parent commit -m "committed by script" 1>/dev/null 2>/dev/null
if [[ $? == 128 ]]; then
git -C $parent commit -m "commited by script" 1>/dev/null 2>/dev/null
git -C $parent push
if [[ $? == 1 ]]; then
git -C $parent pull
git -C $parent push
fi
else
git -C $parent push
if [[ $? == 1 ]]; then
git -C $parent pull
git -C $parent push
fi
fi
) &
fi
done
wait
}
However, when I run it, git asks for username:
Username for 'https://github.com':
Here are the tests I have done, to make sure git has access to GitHub:
ssh -T [email protected]=> successfulsudo -i+ssh -T [email protected]=> successful- I go into a git repository, and I change something, and I manaully add + commit + push => successful
- I go to my home, and add + commit + push from another repository using
-C another_git_repo_path=> successfull
Then why it does not work when I run it from inside a script?
sshmethod? For example, all of them have in.git/configsomething like:url = [email protected]:....instead ofurl = https://github.com/...