I git push my work to a remote Git repository.
Every push will prompt me to input username and password. I would
As far as I know, there are simply two safe ways: ssh or passwd encrypted using a keystore.
cat ~/.ssh/id_rsa.pub, paste it there, name and save it (if you have no such file, generate one for yourself by ssh-keygen -t rsa - just Enter for all prompts);git remote set-url origin git+ssh://git@github.com/username/reponame.git - you can check it first by git remote -v);touch t; git add t; git commit -m "test"; git push and confirm yes to enjoy the password-free world.If you just use git config --global credential.helper store as others mentioned, your unencrypted passwords will be just stored in a plain text under ~/.git-credentials which is not safe as it sounds.
Try to encrypt it as
sudo apt-get install libgnome-keyring-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
git config --global credential.helper store
In this case, you are using
https://git@github.com/username/reponame.git.