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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:15:14+00:00 2026-05-27T15:15:14+00:00

I have (finally) convinced my manager to allow us to set up version control,

  • 0

I have (finally) convinced my manager to allow us to set up version control, and have been doing some research for the past few days and have decided on git.
Anyways I found a tutorial here
http://toroid.org/ams/git-website-howto
on a basic setup, that will push changes to remote repository.
This would work great for our company.

Here are the steps I went through

Local box

cd /website
git init
git add .
git commit -m "Initial commit into git"

server

cd /var/git/
mkdir website.git
cd website.git
git init --bare

mkdir /var/www/website

cat > hooks/post-receive

#!/bin/sh
GIT_WORK_TREE=/var/www/website git checkout -f

chmod +x hooks/post-receive

Local Box

git remote add web ssh://user@server/var/git/website.git
git push web +master:refs/heads/master

Now where i do the push I get the error “This operation must be run in a work tree” This is coming from the post-receive hook.
I know I am missing a step but just not sure what exactly that is…

  • 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-27T15:15:14+00:00Added an answer on May 27, 2026 at 3:15 pm

    I suppose your working directory website is empty. Hence, your git add . does not add anything, and the next commit does not create a new commit.

    In order to generate the master branch, you need to complete at least one commit, with at least one file.

    In the local box, do

    touch empty
    git add empty
    git commit -m "Initial commit into git"
    git push web
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have finally started messing around with creating some apps that work with RESTful
After searching through some existing libraries for JSON, I have finally ended up with
I have been working in Java for the past 4 years and I am
After days of struglling I have finally succeded to take a decent picture on
since 4 days, I try to see how XLib works, and I have finally
I have been making a live wallpaper and have finally succeeded so far, but
I have finally finished my web site. I published it, and I was surprised
I have finally got the green light to use Memcached in our project (after
I have finally decided to go with the Entity Framework since it has the
I have finally worked out how to get stdin and stdout to pipe between

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.