Search code examples
gitgithubgit-remote

Git - why password-less push doesn't update the remote?


I have to make notes while listening to lectures.

Can't store SSH keys and don't want to wait for username-password prompt (lecture doesn't stop); so when I have completed an exercise I do

git push https://username:[email protected]/username/repo.git master

the operation completes without error but when I do git status I get message saying there is a difference between local and remote repos. So I have to do the slow and blocking

git push origin master

and I type the username and password when prompted but then git says everything is up to date why this anomalous behavior?


Yesterday I forgot to do git push origin master at end of class and today in class when I did a git clone ... all the commits I made yesterday were lost and my repo was in state of day before yesterday. Is it possible to recover those?


Solution

  • For the conditions set by OP, I think this is a possible solution

    Create a file, in the home directory, named .git-credentails which should contain the following line

    https://username:[email protected]
    

    replace username and password with appropriate strings and next time OP does a git push origin master s/he won't be prompted for manually entering credentials (iff protocol, hostname, and username pattern match the url of your repository's origin).

    As usual, the best place to get precise information is -- https://git-scm.com/docs/git-credential-store