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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:38:02+00:00 2026-06-16T20:38:02+00:00

I’ve tried this a couple different ways, including creating a new recipe and notifying

  • 0

I’ve tried this a couple different ways, including creating a new recipe and notifying that recipe to run but I keep getting the same problem which is the cloned repo directory doesn’t exist before the file resource runs, so I get a fatal error.

my question is, can I make the git clone finish before the file resource tries to execute or is there a better way to do this?

SN: what I’m trying to accomplish deals w/ new user environment setup – so after creating a new user i’m cloning down a bunch of config files from a git repo that will be deployed for that user.

  git "/home/#{user_id}/.myconfigs" do
    repository "https://url/to/repo"
    reference "master"
    user user_id
    group user_id
    action :checkout
    not_if "test -d /home/#{user_id}/.myconfigs"
    #notifies :run, "recipe[zsh_workstation::zshrc]"
  end

  file "/home/#{user_id}/.zshrc" do
    content IO.read("/home/#{user_id}/.myconfigs/.zshrc")
    owner user_id
    group user_id
    mode "0600"
    action :create_if_missing
  end
  • 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-16T20:38:03+00:00Added an answer on June 16, 2026 at 8:38 pm

    Check Anatomy of a Chef Run

    At the moment chef compiles your file resource, git resource is not run (even is not started) yet, so file “/home/#{user_id}/.myconfigs/.zshrc” does not exist.

    Possible workarounds:

    1. This will copy the file after it is created by git using FileUtils.

      ruby_block "create /home/#{user_id}/.zshrc" do
        block do
          ::FileUtils.copy("/home/#{user_id}/.myconfigs/.zshrc", "/home/#{user_id} /.zshrc") unless ::File.exists? "/home/#{user_id}/.zshrc" 
        end
      end
      
    2. Symlink instead of copy.

      link "/home/#{user_id}/.zshrc" do
        to "/home/#{user_id}/.myconfigs/.zshrc"
      end
      
    3. Run git resource at compile stage.

      git "/home/#{user_id}/.myconfigs" do
        [...]
        action :nothing
      end.run_action :checkout
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was
I know there's a lot of other questions out there that deal with this
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.