gitweb not loading repositories through symlinks - linux

I have gitweb on localhost and a sample project for which I've executed the git init git add and so on. I create a symlink with sudo ln -s /media/dir/project/.git/ /var/cache/git/project.git but it doesn't work and I still get 404 - no project found at localhost/gitweb.
The only way I can only bring the project info titles such as description, ..., then without project info, only the 4 sorting options, is to copy the git physically to /var/cache/git/project.git/ though some files won't be copied. This is the only way I could only not receive the not found error.
I manipulated the /etc/gitweb.conf and /etc/apache2/conf.d/gitweb in anyway, but it didn't help.
(I'm using apache 2.2 under Kubuntu 11.10)
Thanks so much for your helps!

Check the permissions on all of the directories in the symlink path. Whatever user your cgi is running as needs at least +x on all the parent dirs and +r on the .git directory and files.

Related

Weird recursive directory structure

Somehow, my system (Ubuntu WSL layer on Windows; so treat as exactly Ubuntu) went a bit crazy. For a directory (a git repo if it matters) /path/to/foo, running ls shows the git files ORIG_HEAD, index, and index.lock in there.
I tried to debug this by going cd .git, but an ls there showed me my same list of files as the parent!
I went as far as
/path/to/foo/.git/.git/.git
before stopping checking the recursion.
A possibly related issue that managed to show up is that the .htaccess file there is read as a file by Emacs on Windows, a file by vi on Linux, but a directory by emacs and a directory by bash.
That means that my computer really thinks
~/public_html/.git/.htaccess/.htaccess/.git/.htaccess/.git/.git
is identical to
~/public_html
So, needless to say, Apache also craps out and says that it's an invalid htaccess file .... though on an other machine (see: git repo) it runs just fine.
Help?
Tried nuking the directory via rm -rf and git clone-ing back, but the Apache problem persisted.
I removed the symlink to the directory via unlink:
~$ unlink public_html
then re-mounted it, making sure that there wasn't a trailing space
~$ ln -s /mnt/c/Users/USER/pathto/repo /home/USER/public_html

Follow symlinks in SVN

I have a linux directory (and don't need any windows checkout):
/home/me/projects/project1
In this project, I need SVN (1.8.8) to follow a symlink "link1":
/home/me/projects/project1/link1/<some_directories_and_files>
But SVN won't let me do that, it just add link1 but not its content. If I try to add its content, I get an error:
svn add link1/*
svn: E145001: Can't schedule an addition of '/home/me/projects/project1/link1/first_directory' below a not-directory node
I tried converting link1 to hard link but I can't do that either:
ln /path/to/my/linked/directory link1
ln: ‘/path/to/my/linked/directory’: hard link not allowed for directory
Any idea? How do you handle this kind of configuration? I just need to commit everything from /home/me/projects/project1 from a simple svn commit
If I understand your problem, you have:
project1/
project1/link1 -> ../../some/where/else
If you do a simple svn add link1 it adds a symlink entry to the subversion repository, but what you're trying to accomplish is getting the stuff under somewhere else into the tree.
If this is the case, then you're fighting in the wrong direction, you should make the real files and directories under link1, and make the target locations symlinks into the link1 directory. That would be a simple solution to the problem.
Another solution would be to make the location ../../some/where/else an svn location in it's own right, and make link1 an externals definition to that location. When you commit in the main directory, the externals would be committed at the same time which would achieve storing the information; however to ensure that the other location was kept in sync, you would have to make sure to update it to the same version as the stored data.
In my case, on my desktop, I have a settings directory:
$HOME/settings
This is a checked out copy of a directory containing .bashrc, .profile, .vimrc, .vim, etc. files and folders from an svn repo. All my profile files and directories were symlinks into this folder, so for example .profile -> settings/.profile, etc. When I make changes, they are reflected in the svn tree, which I can commit back to in order to ensure that I don't lose my config settings when I go to another system.
If you really want svn to follow symlinks as hardlinks (You can't make directory hardlinks because it would be a bad thing™), then you'll have to hack the svn client source so that it did what you wanted; but this would be a maintenance nightmare.
You could get away with making the symlink into a bind mount point directed at the target, but that has it's own issues - you would need to be root to accomplish this, and it ends up leaving funny entries in your /proc/mounts to accomplish this:
mount --bind /absolute/path/to/some/where/else project1/link1
Bind mounting does not work when mounting to inside the svn tree since the working copy format changes introduced by svn 1.7 - svn operations attempt to move files from .svn/tmp to the target folder, which would be a cross device link. The workaround in this case is to go from the inside out, i.e.:
mount --bind project/link1 /absolute/path/to/somewhere/else
With the change in the svn working copy format of a single .svn folder for the checked out tree, you will need to perform all subsequent operations from the true svn location, as it won’t work from the bind mounted folder, on the assumption that you have not mounted the entire checked out tree at that target location.

OpenShift WordPress Theme Developer workflow

I create a application with Cartridges,
PHP 5.4
MySQL 5.5
phpMyAdmin 4.0
I commit my WP file, plugin and themes into GIT.
In my .gitignore, i added
wp-content/uploads
I did go through the book "Getting Started with OpenShift", as the book chapter 8 said
“The other directory available to you is the OpenShift data directory,
which is currently at $OPENSHIFT_HOMEDIR/app-root/data. We use the
environment variable OPENSHIFT_DATA_DIR to point to this location. ”
“The data directory is where your application should store its files
and put configuration settings, download themes, or generally anything
you want to survive restarts and Git pushes.”
Excerpt From: Steven Pousty and Katie J. Miller. “Getting Started With OpenShift.”
I access to SSH. When I upload my media in WordPress, It is store inside
$OPENSHIFT_REPO_DIR/php/wp-content/uploads/2014/05/1.jpg
1.How do I pointed it to?
$OPENSHIFT_DATA_DIR/uploads
If that is the case, in my .openshift/action_hooks/deploy file, I had added this script
if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then
mkdir ${OPENSHIFT_DATA_DIR}uploads
fi
ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}php/wp-content/
However, the soft link script does not did it job, during my GIT PUSH, it shows the following error.
remote: ln: target `/var/lib/openshift/[ID]/app-root/runtime/repo/php/wp-content/' is not a directory: No such file or directory
my guess is, the $OPENSHIFT_REPO_DIR/php/wp-content/uploads/2014/05/1.jpg , the uploads folder already removed before the script do it job.
How do I keep the uploads folder content in such a situation. OpenShift expert kindly help in this matter.
After I had few attempt of the build script, I finally found out what is my problem.
To answer my own questions
How do I point it.
Create a symlink. During the GIT push, it will definitely delete your uploads folder ($OPENSHIFT_REPO_DIR/wp-content/uploads/).
This is the code you should use, just remove the php folder after the repo.
if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then
mkdir ${OPENSHIFT_DATA_DIR}uploads
fi
ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}wp-content/
I hope it's help.
This file has plenty of examples
https://github.com/openshift/wordpress-example/blob/master/.openshift/action_hooks/deploy
The problem is that with every git push we are going to overwrite that directory.
I think a better idea is with every build rsync contents from your repo over to the data directory where it expects to find the themes (rather than doing the symlink)

svn, can't remove a directory

I am on Fedora 17 trying to use svn version 1.7.6
I have created a repository at /home/el/svnworkspace and I checked out a working copy in /workspace
I am getting this error when I use the command:
[root#defiant workspace]# svn remove TestProject --force
Gives the Error:
svn: E155035: '/workspace/TestProject'
is the root of a working copy and cannot be deleted
The error message is partially right, TestProject was a root before. But I deleted it and now /workspace the root. So somehow it is confused. I no longer want TestProject to be a root, and I want workspace to be the root. svn is confused, and I want to unconfuse it, maybe one of you know the proper wizard incantation to remove /workspace/TestProject as a root of a working copy? I just want it to be a normal folder again.
Perhaps the only way for me to fix it is to blow everything away and re-add everything. Maybe a resident wizard knows a better way.
SVN does get confused about directories sometimes.
Unless you have a lot of changes you need to check in, I suggest removing the hierarchy in question from your filesystem (rm -rf), and checking out again starting from wherever looks appropriate. This always seems to handle SVN directory confusion for me.
I was able to fix the problem with these steps:
Make sure nothing has a lock on the files in question, for me: Eclipse IDE. So close any IDE's or Editors that might have a lock on the file.
Make sure you have write permissions on the working copy as well as the repository.
chmod -R 775 /workspace
chown -R your_user_name.your_user_name 775 /workspace
chmod -R 775 /home/el/svnworkspace
chown -R your_user_name.your_user_name 775 /home/el/svnworkspace
If you are using a program with a GUI like rapidsvn to add/remove/commit files, turn that off and use only the command line svn command. The GUI might have been have been conflicting with what I was trying to do on the command line.
finally, I think this part is what fixed my problem:
Go into the directory that I want to add, but won't add. Manually rm -rf all the .svn files in it. Then try to svn remove it then svn add it. It successfully adds and then I could commit it and all is well.

Subversion: Skipping folders when not in working directory

We have our website files in various Subversion projects checked out on our Ubuntu 12.04 web server, a project for each site.
eg
/var/www/site1/
/var/www/site2/
/var/www/site3/
Now, I can update from subversion if I am in the correct working directory e.g. I go
cd /var/www/site1
svn update filepath
Works fine
...but if I go
svn update /var/www/site1
I get the error:
Skipped 'site1'
Is it do with the fact that each subfolder of /var/www is a seperate Subversion Project checked out seperately? Or am I misunderstanding something entirely.
Thanks!
You need to go into the working copy directory and then do svn up inside that folder.
You can refer another question SVN update: 'skipped' message

Resources