Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created June 6, 2012 21:42
Show Gist options
  • Star 59 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save ahoward/2885020 to your computer and use it in GitHub Desktop.
Save ahoward/2885020 to your computer and use it in GitHub Desktop.
Fix Username/Password prompting for github repos cloned via https scheme

github recently switched to an https scheme as the default for cloning repos. as a side effect you may suddenly be prompted for a 'Username' and 'Password' when you push where, previously, you were able to do so without typing in credentials. the solution is to cause git to cache https credentials which is easy, since git uses curl under the covers

in your home directory create a file called '.netrc', for example

/Users/ahoward/.netrc

in it put these contents

machine github.com
login YOUR_GITHUB_USERNAME
password YOUR_GITHUB_PASSWORD

fixed!

@AliHCl
Copy link

AliHCl commented Sep 25, 2023

2021-02-20_04-26-57

من مشکل یورنیم وپسورد دارم کمکم کنید

First, type the command 'gh auth login' in the command line, then use the arrow keys on your keyboard to select the option 'GitHub.com' and press Enter. After that, choose the 'http' , and then log in to your account through browser.

@miraclemarko
Copy link

### THIS IS FOR FIX SOLUTION YOUR PROBLEM.

Run

git config --global credential.helper store

DONE. THANKYOU

@Queetinliu
Copy link

i use gitlab,yes use this solution i can git clone without username password promption.

@pooriar1991
Copy link

2021-02-20_04-26-57

من مشکل یورنیم وپسورد دارم کمکم کنید
یوزر پسورد گیت هاب‌ت رو بزن اکی میشه

@MrSavage6995
Copy link

Probably dumb question but where it says your_username I use mine lmao 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment