Trac usage: Creating and accessing projects
The below usage notes are dependent on trac-initproject.
The exemplary project name is called foobar.
git
To initialize the project, log into the Trac server and execute:
trac-initproject git foobar
Developers can then upload their local master branch using the following methods:
If public push access is enabled:
git-push git://appliance_ip/git/foobar master
Or, over an SSH connection:
git-push ssh://root@appliance_ip/srv/repos/git/public/foobar.git master
Optionally, the developer can configure the remote repository for simpler future updates:
git-config remote.turnkey-trac.url ssh://root@appliance_ip/srv/repos/git/public/foobar.git git-config remote.turnkey-trac.push +master:refs/heads/master git-push turnkey-trac
Users can then clone the remote repository using the following methods:
Anonymously:
git-clone git://appliance_ip/git/foobar
Or, over an SSH connection:
git-clone ssh://root@appliance_ip/srv/repos/git/foobar
Bazaar (bzr)
To initialize the project, log into the Trac server and execute:
trac-initproject bzr foobar
Developers can then upload their local branch:
Over an SFTP connection (depends on python-paramiko)
bzr push sftp://root@1.0.0.94/srv/repos/bzr/foobar
If there is no default push location set, the first push will set it. After that, the location can be omitted and the default will be used:
bzr push
Users can then clone the remote repository:
bzr clone bzr://appliance_ip/bzr/foobar
Mercurial (hg)
To initialize the project, log into the Trac server and execute:
trac-initproject hg foobar
Developers can then upload their local branch using the following methods:
Note the extra slash. Mercurial assumes paths are relative to the users home directory over SSH connections:
hg push ssh://root@appliance_ip//srv/repos/hg/foobar
Optionally, the developer can configure the remote repository for simpler future updates, by adding the following to foobar/.hg/hgrc
[paths] default-push = ssh://root@appliance_ip//srv/repos/hg/foobar
Future pushes can then be performed as follows:
hg push
Users can then clone the remote repository:
hg clone http://appliance_ip:8080/foobar
Subversion (svn)
To initialize the project, log into the Trac server and execute:
trac-initproject svn foobar
Developers can then checkout the remote repository, make changes, then commit back to the remote repository:
Checkout over SSH:
svn co svn+ssh://root@appliance_ip/srv/repos/svn/foobar
After making local changes, they can be commited to the remote repository:
svn commit
Users can then checkout the remote repository using the following methods:
Anonymously:
svn co svn://appliance_ip/svn/foobar
Or, over an SSH connection:
svn co svn+ssh://root@appliance_ip/srv/repos/svn/foobar
Comments
I can't use trac-initrepo
As I issue "trac-initrepo svn foobar", it always results to "command not found". Please help.
trac-initrepo -> trac-initproject
Just to be clear, the above usage notes are dependent on trac-initproject.
trac-initproject
when i run trac-initproject svn foobar i get
: invalid option
any ideas?
Solution
1. Log in as root through putty or onto the local server
2. reate the script by typing "nano /usr/local/bin/trac-initproject" it will open a new file.
3. Copy the code below and pase it if using putty or write it in the terminal.
#!/bin/bash -e #Copyright (c) 2009 Alon Swartz <alon@turnkeylinux.org> - all rights reserved fatal() { echo "fatal: $@" 1>&2 exit 1 } esc() { echo $1 | sed "s/\//\\\\\//g" } init_trac_project() { echo "initializing trac project: $VC" trac-admin $PROJ_LIB initenv "$PROJ_NAME" sqlite:db/trac.db $VC $PROJ_REPO trac-admin $PROJ_LIB permission add $ADMIN_USER TRAC_ADMIN mv $PROJ_LIB/conf/trac.ini $INI ln -s $INI $PROJ_LIB/conf/trac.ini chown www-data:www-data $INI sed -i "s/^alt = \(.*\)/alt = trac logo/" $INI sed -i "s/^height = \(.*\)/height = 73/" $INI sed -i "s/^link = \(.*\)/link = \/$PROJ/" $INI sed -i "s/^width = \(.*\)/width = 236/" $INI sed -i "s/^src = \(.*\)/src = $(esc site/logo.png)/" $INI sed -i "s/^descr = \(.*\)/descr = $PROJ_NAME/" $INI sed -i "s/^smtp_enabled = \(.*\)/smtp_enabled = true/" $INI sed -i "s/trac@localhost/root@localhost/g" $INI rmdir $PROJ_LIB/htdocs ln -s $TRAC_SHARE/htdocs/site $PROJ_LIB/htdocs rmdir $PROJ_LIB/plugins ln -s $TRAC_SHARE/plugins $PROJ_LIB/plugins chown -R www-data:www-data $TRAC_LIB } if [ $# -ne "2" ]; then echo "Syntax: $0 git|bzr|svn|hg NAME" echo "Example: $0 git foobar" echo echo "Environment variables:" echo " GIT_PUBLIC_WRITE enabled public write access (default: yes)" exit 1 fi VC=$1 NAME=$2 ADMIN_USER=admin TRAC_ETC=/etc/trac TRAC_LIB=/var/local/lib/trac TRAC_SHARE=/usr/local/share/trac PROJ=$VC-$NAME PROJ_LIB=$TRAC_LIB/$PROJ PROJ_REPO=/srv/repos/$VC/$NAME PROJ_NAME="$VC $NAME project" INI=$TRAC_ETC/$PROJ.ini set ${GIT_PUBLIC_WRITE:=yes} case "$VC" in git) # initialize empty repository mkdir -p $PROJ_REPO cd $PROJ_REPO git-init touch $PROJ_REPO/.git/git-daemon-export-ok ln -s $PROJ_REPO/.git /var/cache/git/$NAME.git echo $name > $PROJ_REPO/.git/description # allow public git-push to repo if [ "$GIT_PUBLIC_WRITE" == "yes" ]; then echo "[daemon]" >> $PROJ_REPO/.git/config echo " uploadpack = true" >> $PROJ_REPO/.git/config echo " uploadarchive = true" >> $PROJ_REPO/.git/config echo " receivepack = true" >> $PROJ_REPO/.git/config fi # initialize trac project init_trac_project INI=$TRAC_ETC/$VC-$NAME.ini GIT_REPO=/var/cache/git/$NAME.git sed -i "s/^repository_dir =\(.*\)/repository_dir = $(esc $GIT_REPO)/" $INI sed -i "s/^git_bin = \(.*\)/git_bin = $(esc /usr/bin/git)/" $INI echo "[components]" >> $INI echo "tracext.git.* = enabled" >> $INI ;; bzr) # initialize empty repository mkdir -p $PROJ_REPO cd $PROJ_REPO bzr init-repository . # initialize trac project init_trac_project INI=$TRAC_ETC/$VC-$NAME.ini echo "[components]" >> $INI echo "tracbzr.* = enabled" >> $INI ;; hg) # initialize empty repository mkdir -p $PROJ_REPO cd $PROJ_REPO hg init # initialize trac project init_trac_project INI=$TRAC_ETC/$VC-$NAME.ini echo "[components]" >> $INI echo "tracext.hg.* = enabled" >> $INI ;; svn) # initialize empty repository mkdir -p $PROJ_REPO svnadmin create $PROJ_REPO # initialize trac project init_trac_project ;; *) fatal "unsupported VC: $VC" ;; esac4. save it by pressing SHIFT key+X press y and enter
5. enter command as root "
"
6. then follow steps on this page http://www.turnkeylinux.org/docs/trac/usage
Replace foobar with whatever project name you want.
I hope this will help.
About this problem :invalid
Hi, I copy - paste this lines and still showing the same error :invalid, why this happening? what's invalid? thanks on advantage.
What about revision control appliance?
What about revision control appliance? How do I add repos there?
I tried to copy trac-initproject (after i installed trac via apt-get install trac) and I get
Wrong number of arguments to initenv: 4
Any clues? I didn't find any explicit instructions on revision appliance page :(
thanks!
Removing the example projects?
How do I remove the example projects?
Remove project
I would also like to know how to remove example project (trac + respository - git).
You can remove repository and trac settings
You can remove:
/srv/repos/git/your_project
/var/local/lib/trac/your_project
/etc/trac/your_project.ini
Accessing by
How would one install DAV svn on Turnkey Trac? (I don't see it already installed.)
Some 3rd party svn clients don't play well with svn+ssh.
Thanks!
Error with initproject
I'm getting this error when run trac-initproject
All chmod and chown was made with no luck :(
Error with initproject
Same error here :(
some advice?
permission fixed
Ok, I fixed the problem myself :)
I just changed all the files owner to www-data:
chown -R www-data.www-data *
in the trac folder (/var/local/lib/trac/your-project-name)
Security question for committing
Sorry for the newbie question, guys, but how do I give my development team access to commit their changes to the svn repo without giving them the root password?
According to the above you can only commit through SSH, so I created a new Linux user called svn that I planned on distributing to my team, instructing them to access the repo as follows:
However, when I commit from TortoiseSVN I get the following error:
I guess the issue is that the /srv/repos directory (and everything below it) is owned by root, but I don't want to change that and risk breaking everything.
Any tips?
Thanks!
Re: Security question for committing
You should change the group ownership of
to the group of the user 'svn' and also change the mode of files and dirs to 775. If the user 'svn' has group 'users' then the following will do the trick.
You better use svn auth,
You better use svn auth, configure at /srv/repos/svn/yourepo/conf/svnserver.conf search in [general] activate auth-access = write and set password-db. Now add users at .../conf/passwd file. Once youre done restart the svn server with /etc/init.d/svnserve restart.
Just comit with svn ci svn://yourip/svn/yourrepo and you will be prompted by the username in some point.
Thanks!
My thanks to both René and "Guest" for their responses. I decided to go along with the latter's, as it's less "intrusive" and my repository isn't especially sensitive (so no need for SSH).
Adding a user
I have my repository setup and I have it secured usin svn auth, but how do I add a user to the projcet so they can view and add tickets?
GIT: Line 75: git-init: command not found
Hello,
I am trying to use the helper script to create a new GIT project. When executing from the command line:
Setting up a multi-project multi-user git repo with turnkey trac
I spent a few days setting up a multi-user multi-project git repo using turnkey trac. Finally I made it, it is up successfully and the instructions are availeble at http://wp.me/p1BbXy-B . This applies to the following version spec:
Trac: 0.11.7
Python: 2.6.5 (r265:79063, Apr 16 2010, 13:28:26) [GCC 4.4.3]
setuptools: 0.6
SQLite: 3.6.22
pysqlite: 2.4.1
Genshi: 0.5.1
mod_wsgi: 2.8 (WSGIProcessGroup wsgitrac WSGIApplicationGroup 127.0.1.1|)
Pygments: 1.2.2
GIT: 1.7.0.4