Git asks for username every time I push
Edit (by @dk14 as suggested by moderators and comments)
WARNING: If you use credential.helper store
from the answer, your password is going to be stored completely unencrypted ("as is") at ~/.git-credentials
. Please consult the comments section below or the answers from the "Linked" section, especially if your employer has zero tolerance for security issues.
Even though accepted, it doesn't answer the actual OP's question about omitting a username only (not password). For the readers with that exact problem @grawity's answer might come in handy.
Original answer (by @Alexander Zhu):
You can store your credentials using the following command
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
Also I suggest you to read$ git help credentials
Git asks for username every time I push
Edit (by @dk14 as suggested by moderators and comments)
WARNING: If you use credential.helper store
from the answer, your password is going to be stored completely unencrypted ("as is") at ~/.git-credentials
. Please consult the comments section below or the answers from the "Linked" section, especially if your employer has zero tolerance for security issues.
Even though accepted, it doesn't answer the actual OP's question about omitting a username only (not password). For the readers with that exact problem @grawity's answer might come in handy.
Original answer (by @Alexander Zhu):
You can store your credentials using the following command
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
Also I suggest you to read$ git help credentials
Git keeps asking me to enter username and password
Just visit this page on GitHub and follow the instructions:
- set credential helper first (explained clearly in the page)
- for different types of credential helpers for different OSs' follow this link
- then on the next prompt for password use your PAT instead (again explained clearly)
Git push asks username & password for HTTP repo origin
So, I have updated my origin
remote from https to ssh and added a ssh public key to my github account after creating one which is well defined by github finally my problem solved and now I can push to my repo without any credential prompt by the terminal. Thank you Code-Apprentice.
Git asks password for wrong username whenever I git pull or push
First, you can view the URL used for the BitBucket repo by typing
git remote -v
This most likely will show that your colleague cloned has a remote that specifies your user name. The easiest way to fix this is to remove the user name from the url:
git remote set-url origin https://bitbucket.org/myself/my-repo.git
Now when they push/pull/fetch/etc, git will ask for both a user name and a url.
If your colleague doesn't want to type the user name each time, then they can instead do
git remote set-url origin https://colleague@bitbucket.org/myself/my-repo.git
If you are annoyed by always typing a username and password, I suggest setting up an SSH key and uploading the public key to BitBucket. The BitBucket docs explain how to do this. SSH is very convenient and provides secure access to your accounts.
Related Topics
Print a File, Skipping the First X Lines, in Bash
Adding a New Entry to the Path Variable in Zsh
How Many Socket Connections Possible
Is There a "Goto" Statement in Bash
Bash While Read Loop Extremely Slow Compared to Cat, Why
How to Replace Spaces in File Names Using a Bash Script
What Does the Number in Parentheses Shown After Unix Command Names in Manpages Mean
Exploring Docker Container'S File System
"Failed to Load Platform Plugin "Xcb" " While Launching Qt5 App on Linux Without Qt Installed
How to Recursively Grep All Directories and Subdirectories
Finding Which Process Was Killed by Linux Oom Killer
How to Debug the Linux Kernel With Gdb and Qemu
What Happens If There Is No Exit System Call in an Assembly Program
How to Install Latest Version of Git on Centos 8.X/7.X/6.X
"Unable to Find Remote Helper For 'Https'" During Git Clone