Skip to main content
  1. About
  2. Stack Internal
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Git - How to use .netrc file on Windows to save user and password

Is it possible to use a .netrc file on Windows when I'm using Git to clone a remote repository with HTTP and user - password?

Answer*

Draft saved
Draft discarded

Required fields are marked with *

Cancel
21
  • @Luke: yes, the git-cmd.bat included in msysgit does set the %HOME% environment variable, as I mentioned last December: stackoverflow.com/questions/8514097/… Commented Jan 23, 2012 at 21:39
  • @爱国者 netrc is used by curl, and works for http protocol, as shown in this example (look for 'netrc' in the page): maymay.net/blog/2008/08/08/… . Also used with http protocol here: stackoverflow.com/questions/5193643/… Commented Feb 3, 2012 at 4:58
  • @VonC I just added another trap both Marc and I hit to the bottom. Commented May 11, 2012 at 5:29
  • @SamSaffron What version of Git are you using? Just to make sure it isn't related to stackoverflow.com/questions/10464250/remote-pushurl-wont-work and github.com/git/git/blob/master/Documentation/RelNotes/… Commented May 11, 2012 at 6:35
  • 1
    @AndreyS If you see HOME defined in your user environment variables, but you don't see it when typing set HOME in your current CMD, you need to open a new CMD in order for said shell session to inherit the variables you have defined. Commented Jun 12, 2022 at 14:32

AltStyle によって変換されたページ (->オリジナル) /