Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4022048
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:25:36+00:00 2026-05-20T10:25:36+00:00

I’ve been looking at Git and cURL and I found some references about .netrc,

  • 0

I’ve been looking at Git and cURL and I found some references about .netrc, that may help on HTTP authentication. The problem is: .netrc is dumb, because it stores passwords in plain text format, which is a big security issue for the solution I’m developing.

Is there an alternative to the .netrc approach? Is it possible to develop an “authentication backend” to cURL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:25:36+00:00Added an answer on May 20, 2026 at 10:25 am

    Update April 2013, git 1.8.3:

    A new read-only credential helper (in contrib/) to interact with the .netrc/.authinfo files has been added.

    That script would allow you to use gpg-encrypted netrc files, avoiding the issue of having your credentials stored in a plain text file.

    To enable this credential helper:

    git config credential.helper '$shortname -f AUTHFILE1 -f AUTHFILE2'
    

    (Note that Git will prepend "git-credential-" to the helper name and look for it
    in the path.)

    **See a full example at "Is there a way to skip password typing when using https:// github**"


    Original answer (March 2011)

    The only alternative (except not using it and going through ssh) would be to:

    • encrypt that file (for instance, on Windows, with the utility ‘crypt‘)
    • decrypt it just before the curl call
    • then encrypt it again right after the curl call

    Note that on Unix, that file is normally in mode 600, only visible by you.
    On Windows (_netrc), that file should be in your HOMEDIR, which shouldn’t be accessible (through Windows ACL) to any other users.
    But I still don’t like a password in plain text…

    This thread, for example, goes through the same process (on Unix for gpg, but it still illustrates the solution nicely):

    Below I have included a sample script implementing the usage of ‘gpg‘, which can be used to encrypt the contents of a file. It’s in shell script, however I’m sure you can adapt the concept to your perl script.

    I think for your needs the basic idea is:

    1. create a plain-text file with your password (and other info)
      2. encrypt it using gpg and store the encrypted file; dispose of the plain-text file
      3. Within the perl script, decrypt the encrypted file into a plain-text file
      4. read contents of plain-text file during runtime of your script
      5. delete plain-text file as soon as possible.

    Here’s just an example of the workings of gpg:

    #!/bin/sh
    echo -n "Enter your password: "
    read pass
    
    FILE=~/mypassword
    echo $pass > $FILE
    gpg -c $FILE
    rm -f $FILE
    
    gpg $FILE.gpg
    MYPASSWORD=`cat $FILE`
    rm -f $FILE
    
    echo $MYPASSWORD
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm looking for suggestions for debugging... If you view this site in Firefox or
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.