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 8153865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:09:21+00:00 2026-06-06T16:09:21+00:00

I have a shell variable which points to the directory where all my configuration

  • 0

I have a shell variable which points to the directory where all my configuration files are located. Let’s assume the variable is created with export RC=$HOME/rc. I have a global ignore file in the configuration directory: ~/rc/globalgitignore.

My Question is, how can I expand the RC variable in my .gitconfig file?

I already tried the following:

  • excludesfile = $RC/globalgitignore

  • excludesfile = !$RC/globalgitignore

  • excludesfile = !echo $RC/globalgitignore

  • excludesfile = !$(echo $RC/globalgitignore)

None of these solutions work.

The only way this works if I enter the full path: excludesfile = ~/rc/globalgitignore, but then I have to change the path if move my rc directory to a different location.

  • 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-06-06T16:09:22+00:00Added an answer on June 6, 2026 at 4:09 pm

    You can’t. git-config(1) does not support environment variable expansion, but only limited type conversion and path expansion:

    The type specifier can be either –int or –bool, to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int, a “true” or “false” string for bool), or –path, which does some path expansion (see –path below). If no type specifier is passed, no checks or transformations are performed on the value.

    The documentation for --path states:

    –path

    git-config will expand leading ~ to the value of $HOME, and ~user to the home directory for the specified user. This option has no effect when setting the value (but you can use git config bla ~/ from the command line to let your shell do the expansion).

    The term “expansion” does not appear in any different context in git-config(1). So how did you even get the idea that it should, given that no such feature is documented anywhere?

    In order to expand environment variables you have to pre-process the Git config file yourself, i.e. by creating a template file, and expand variables with a script before copying the file to your $HOME directory.

    If it’s about dotfile management, then do, what all people do: Put them in a directory, and add symlinks to this directory from your $HOME.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shell script which outputs all of the .js and .html files
Have a shell script that reads the files in a particular directory. #!/bin/bash for
I have a shell and I use pwd to show in which directory I
I have a variable in a shell script in which I'd like to format
I have an app which runs and reads a text configuration file. This points
I have a shell script in which I have to execute two queries (on
I have a shell script, which is run under a opensuse linux, that starts
I have two scripts parent.sh and child.sh. There is a variable in parent.sh which
I have an old shell script which needs to be moved to bash. This
I have a bash shell script which has the line: g=$(/bin/printf ${i}) when ${i}

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.