Question

I followed this guide and Step 4 says to do some stuff with .bash_profile, add some work tree. I think this is what's causing my problem, which I'll explain further down.

# GIT  
export GIT_DIR=~/repo.git  
export GIT_WORK_TREE=~/www 

I'm not really good at Git, but I got through the guide and it actually sorta worked.

My problem now is, that I don't want to use Git deployment directly from local -> server, but rather local -> github/bitbucket/etc -> server, because I need a visual of what I'm actually doing, and I found the guide mentioned way too advanced for what I actually needed.

Now I'm using this guide and have everything working out great, except when it comes to clone from github to my server, the end of step 3. If I try and clone the repo I'm met with:

fatal: working tree '/var/www/vhosts/soegaardcykler.dk/httpdocs' already exists.

I've deleted everything in .bash_profile, and tried going backwards on the first-mentioned guide to actually sort out every little bit of mess I might have caused.

If I try and create a new git repository in a new folder inside of

/var/www/vhosts/soegaardcykler.dk/httpdocs/

I'm met with:

fatal: Could not switch to '/var/www/vhosts/soegaardcykler.dk/sc-gh/': No such file or directory

Something somewhere thinks that the above path is the path to use.. And I have no idea where to undo this.

Is an uninstall of git my only option? And if so, how would I go about doing that?

Bonus info: I'm on a mediatemple (dv), using CentOS5 and logged in as /bin/bash on a domain-user when this problem occurs.

If I try navigativing to the soegaardcykler.dk-folder as root and make a new dir, or go into an old, I'm able to do a git init, which I can't as /bin/bash domain-user.. Being in the same dir as root and /bin/bash domain-user doing "git status" on both gives the normal git message as root, initial commit etc. As domain user I'm met with

fatal: Not a git repository: '/var/www/vhosts/soegaardcykler.dk/sc-gh/'

(please note that the above dir doesn't even exist! And it doesn't matter if I'm trying to do it in a new dir initialized as git with root, or another dir that isn't initialized with git.

I hope you understand my question. I'm very confused myself and having a hard time explaining my issue (hence my google searches suck as well). This is why a designer should never go about messing with backend developer-stuff.

At this point I wish I could reset everything with git on my server and start fresh!

Was it helpful?

Solution

At this point of confusion (I can't understand what's screwed up here) you must effectively start fresh.

Don't do stuff as root, to start with. Never.

Uninstalling git won't do anything better, except loss of time.

In this case adopt good reflex when asking:

  • don't issue error messages without the command you entered.
  • you say you've modified environment variables and you think it has screwed things; why don't you check their value and post it in question? It's just echo $GIT_DIR command.

Try to clone your github repo in a classical way (without different locations for git-dir and working tree) and do things step by step. Come up here when you have questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top