-
Recent Posts
-
Archives
- September 2025
- December 2024
- August 2024
- September 2023
- July 2022
- October 2021
- August 2021
- April 2021
- October 2020
- May 2020
- December 2019
- August 2019
- May 2019
- August 2018
- June 2018
- March 2018
- December 2017
- October 2016
- April 2016
- February 2016
- December 2015
- November 2015
- June 2015
- April 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- November 2013
- October 2013
- August 2013
- July 2013
- June 2013
- April 2013
- March 2013
- February 2013
- August 2012
- May 2012
- February 2012
-
Categories
-
Meta
-
RSS links
Uploading a new Git repo to Alioth
Over the years, I’ve always uploaded my local git repo (git clone –bare myrep repo.git) as a tarball, which I then uncompress. But I’ve been tired of doing that by hand, so I wrote a tiny shell script for it. Nothing fancy. You just do:
alioth-new-git openstack
then it uploads your current repo to Alioth under /git/openstack, for example. It’s a really stupid script, please don’t point me to gbp-create-remote-repo, I know it exists, but I prefer my own tiny thing. Here’s the (lame) script:
#!/bin/sh
set -e
CWD=`pwd`
PKG_NAME=`basename ${CWD}`
usage () {
echo "0ドル creates a new Git repository out of your current working tree on alioth."
echo "You must be at the root of that local git repository"
echo "0ドル will use the current folder as the name for the Alioth git repository."
echo ""
echo "Usage: 0ドル <destination-project-path-on-alioth>"
echo "example: 0ドル openstack will create a /git/openstack/${PKG_NAME}.git repository"
echo "note that you will need to have write access on the destination project,"
echo "which means you must be a member of that said project on Alioth."
echo ""
echo "Please send patch/comments to: Thomas Goirand <zigo@debian.org>"
exit 1
}
if [ $# != 1 ] ; then
usage
fi
DEST_PROJECT=1ドル
# Create the tarball and upload it to Alioth
cd ..
echo "===> Cloning ${PKG_NAME} as bare: ${PKG_NAME}.git"
git clone --bare ${PKG_NAME} ${PKG_NAME}.git
echo "===> Building tarball: ${PKG_NAME}.git.tar.gz"
tar -czf ${PKG_NAME}.git.tar.gz ${PKG_NAME}.git
echo "===> Uploading ${PKG_NAME}.git.tar.gz to vasks.debian.org"
scp ${PKG_NAME}.git.tar.gz vasks.debian.org:
# Uncompress it on Alioth, fix perms and hook
# note that the below block should be put back in a single
# line, but has been broken into multiple lines for readability
# on this blog
ssh vasks.debian.org "cd /git/${DEST_PROJECT} &&
echo '===> Uncompressing ${PKG_NAME}.git.tar.gz in /git/${DEST_PROJECT}' &&
tar -xzf ~/${PKG_NAME}.git.tar.gz &&
echo '===> Activating update-server-info hook' &&
mv ${PKG_NAME}.git/hooks/post-update.sample ${PKG_NAME}.git/hooks/post-update &&
cd /git/${DEST_PROJECT}/${PKG_NAME}.git &&
git --bare update-server-info &&
echo '===> Deleting tarball on alioth' &&
rm ~/${PKG_NAME}.git.tar.gz &&
echo '===> Fxing g+w unix permissions' &&
find /git/${DEST_PROJECT}/${PKG_NAME}.git -exec chmod g+w {} \\;"
# Clean localy created files
echo "===> Cleaning local bare copy and tarball"
rm ${PKG_NAME}.git.tar.gz
rm -rf ${PKG_NAME}.git
This entry was written by Goirand Thomas , posted on February 1, 2012 at 12:55 am, filed under Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Both comments and trackbacks are currently closed.