When you engage with a remote repository via HTTPS URLs through the command line, you'll inevitably encounter prompts for your GitHub username and password. This can be rather frustrating, wouldn't you agree?
Nevertheless, there are some notable advantages to using an HTTPS remote URL: it's considerably simpler to configure compared to SSH 😅, and it typically circumvents the restrictions imposed by stringent firewalls and proxies. However, it does come with the drawback of incessantly requesting your GitHub user credentials whenever you perform a repository pull or push 😞.
Fortunately, there's a way to rectify this predicament by configuring Git to handle your password for you. Here's the step-by-step solution:
1. Update the origin remote URL to use SSH instead of HTTPS:
git remote set-url origin git@github.com:username/repo.git
Or, for those who prefer an alternative approach:
2. Configure Git to store your username and password, effectively eliminating the need for manual entry:
git config --global credential.helper store
3. If you want to take it a step further and cache your credentials for a session, you can use:
git config --global credential.helper cache
4. Optionally, you can set a specific timeout for the credential cache to enhance security:
git config --global credential.helper 'cache --timeout=600'
Voilà ! You've successfully resolved the issue, and from this point onward, Git won't pester you for your credentials anymore. 😄