Created
June 25, 2009 15:33
-
-
Save kogakure/135926 to your computer and use it in GitHub Desktop.
Bash: Convert folders recursively to git repos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Convert folders recursively to git repos | |
| # Run it in the folder that holds all your project folders | |
| for i in $( ls -d */ ); do | |
| string=$i | |
| length=${#string} | |
| project=${string:0:$length-1} | |
| cd $project | |
| junkdel # Special script to delete all junk files | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| git clone --bare -l .git ../$project.git | |
| cd .. | |
| cd $project.git | |
| touch git-daemon-export-ok | |
| touch GITWEB_EXPORT_OK | |
| echo $project > description | |
| git --bare update-server-info | |
| chmod a+x hooks/post-update | |
| git gc | |
| cd .. | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment