{"id":1,"date":"2012-02-01T00:55:59","date_gmt":"2012-02-01T00:55:59","guid":{"rendered":"http:\/\/thomas.goirand.fr\/blog\/?p=1"},"modified":"2012-02-01T02:01:29","modified_gmt":"2012-02-01T02:01:29","slug":"hello-world","status":"publish","type":"post","link":"http:\/\/thomas.goirand.fr\/blog\/?p=1","title":{"rendered":"Uploading a new Git repo to Alioth"},"content":{"rendered":"<p>Over the years, I&#8217;ve always uploaded my local git repo (git clone &#8211;bare myrep repo.git) as a tarball, which I then uncompress. But I&#8217;ve been tired of doing that by hand, so I wrote a tiny shell script for it. Nothing fancy. You just do:<\/p>\n<p>alioth-new-git openstack<\/p>\n<p>then it uploads your current repo to Alioth under \/git\/openstack, for example. It&#8217;s a really stupid script, please don&#8217;t point me to gbp-create-remote-repo, I know it exists, but I prefer my own tiny thing. Here&#8217;s the (lame) script:<\/p>\n<pre>#!\/bin\/sh\r\n\r\nset -e\r\n\r\nCWD=`pwd`\r\nPKG_NAME=`basename ${CWD}`\r\n\r\nusage () {\r\necho \"$0 creates a new Git repository out of your current working tree on alioth.\"\r\necho \"You must be at the root of that local git repository\"\r\necho \"$0 will use the current folder as the name for the Alioth git repository.\"\r\necho \"\"\r\necho \"Usage: $0 &lt;destination-project-path-on-alioth&gt;\"\r\necho \"example: $0 openstack will create a \/git\/openstack\/${PKG_NAME}.git repository\"\r\necho \"note that you will need to have write access on the destination project,\"\r\necho \"which means you must be a member of that said project on Alioth.\"\r\necho \"\"\r\necho \"Please send patch\/comments to: Thomas Goirand &lt;zigo@debian.org&gt;\"\r\nexit 1\r\n}\r\n\r\nif [ $# != 1 ] ; then\r\nusage\r\nfi\r\n\r\nDEST_PROJECT=$1\r\n\r\n# Create the tarball and upload it to Alioth\r\ncd ..\r\necho \"===&gt; Cloning ${PKG_NAME} as bare: ${PKG_NAME}.git\"\r\ngit clone --bare ${PKG_NAME} ${PKG_NAME}.git\r\necho \"===&gt; Building tarball: ${PKG_NAME}.git.tar.gz\"\r\ntar -czf ${PKG_NAME}.git.tar.gz ${PKG_NAME}.git\r\necho \"===&gt; Uploading ${PKG_NAME}.git.tar.gz to vasks.debian.org\"\r\nscp ${PKG_NAME}.git.tar.gz vasks.debian.org:\r\n\r\n# Uncompress it on Alioth, fix perms and hook\r\n# note that the below block should be put back in a single\r\n# line, but has been broken into multiple lines for readability\r\n# on this blog\r\nssh vasks.debian.org \"cd \/git\/${DEST_PROJECT} &amp;&amp;\r\necho '===&gt; Uncompressing ${PKG_NAME}.git.tar.gz in \/git\/${DEST_PROJECT}' &amp;&amp;\r\ntar -xzf ~\/${PKG_NAME}.git.tar.gz &amp;&amp;\r\necho '===&gt; Activating update-server-info hook' &amp;&amp;\r\nmv ${PKG_NAME}.git\/hooks\/post-update.sample ${PKG_NAME}.git\/hooks\/post-update &amp;&amp;\r\ncd \/git\/${DEST_PROJECT}\/${PKG_NAME}.git &amp;&amp;\r\ngit --bare update-server-info &amp;&amp;\r\necho '===&gt; Deleting tarball on alioth' &amp;&amp;\r\nrm ~\/${PKG_NAME}.git.tar.gz &amp;&amp;\r\necho '===&gt; Fxing g+w unix permissions' &amp;&amp;\r\nfind \/git\/${DEST_PROJECT}\/${PKG_NAME}.git -exec chmod g+w {} \\\\;\"\r\n\r\n# Clean localy created files\r\necho \"===&gt; Cleaning local bare copy and tarball\"\r\nrm ${PKG_NAME}.git.tar.gz\r\nrm -rf ${PKG_NAME}.git<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Over the years, I&#8217;ve always uploaded my local git repo (git clone &#8211;bare myrep repo.git) as a tarball, which I then uncompress. But I&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1"}],"collection":[{"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":5,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":8,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/8"}],"wp:attachment":[{"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/thomas.goirand.fr\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}