diff --git a/bin/build-release.sh b/bin/build-release.sh
index eb38c05e02a46a38b5d303da44bf6cdd36f5c2c9..26ed908046ace8bc758e79392ebc54448b8fb577 100755
--- a/bin/build-release.sh
+++ b/bin/build-release.sh
@@ -24,7 +24,7 @@ COMPOSER="/tmp/composer.phar"
 cd /tmp
 
 if [ -a "$TARGET" ]; then
-    echo "$0: Destination already exists: $TARGET" >&2
+    echo "$0: Destination already exists: /tmp/$TARGET" >&2
     exit 1
 fi
 
@@ -43,6 +43,10 @@ php "$COMPOSER" config version "v$VERSION"
 # Install dependencies (without vcs history or dev tools)
 php "$COMPOSER" install --no-dev --prefer-dist -o
 
-php "$COMPOSER" archive -f tar.gz --dir /tmp --file "$TARGET"
+cd ..
+for f in `grep export-ignore "$TARGET/.gitattributes"|cut -d ' ' -f 1`; do
+    rm -r "$TARGET/$f"
+done
+tar --owner 0 --group 0 -cvzf "/tmp/$TARGET.tar.gz" "$TARGET"
 rm "$COMPOSER"
 echo `sha256sum /tmp/$TARGET.tar.gz`
diff --git a/composer.json b/composer.json
index ac57a78d5e7a9d4d6a9d8bb2532b583292ef79ef..451305a4ddd7f65cf65257d3f697ed2161bb68bd 100644
--- a/composer.json
+++ b/composer.json
@@ -108,25 +108,5 @@
             "simplesamlphp/composer-module-installer": true,
             "muglug/package-versions-56": true
         }
-    },
-    "archive": {
-        "exclude": [
-            ".editorconfig",
-            ".gitattributes",
-            ".gitignore",
-            ".markdownlintignore",
-            ".markdownlintrc",
-            ".php_cs.dist",
-            "bin/build-release.sh",
-            "cert/.gitkeep",
-            "codecov.yml",
-            "node_modules",
-            "phpcs.xml",
-            "phpunit.xml",
-            "phpunit-interoperability.xml",
-            "psalm.xml",
-            "public/assets/.gitkeep",
-            "tests"
-        ]
     }
 }