how to fix git always asking username and password.

   1. using SSH instead of https

      git remote set-url origin git@github.com:username/repo.git

2.storing the username and password 
     git config --global
credential.helper store
or save them for just one session
     git config --global credential.helper cache
  or set a timer for them
git config -- global credential.helper 'cache --timeout=600'

原文地址:https://www.cnblogs.com/zjhangia/p/14994249.html