Much of this is now out of date since the newer version of GitBucket that we have can now be almost entirely driven via the REST API. Leaving as-is until I get around to documenting how to use the REST API.
GITBUCKET_HOME
setting in the System Settings will show you the parent folder. Append /data
to that folder for the database name. Staff server is: jdbc:h2:/home/git/data/data;IFEXISTS=TRUE
INFO323 student server is: jdbc:h2:/home/git-info323/data-info323/data;IFEXISTS=TRUE
INFO221 student server is: jdbc:h2:/home/git-info221/data-info221/data;IFEXISTS=TRUE
sa
.for p (`cat passwords.txt`); do echo -n $p | sha1sum; done;for a CSV :
for p (`cat data.csv | cut -d ',' -f5`); do echo -n $p | sha1sum; doneFor TSV:
for p (`cat data.tsv | cut -f4`); do echo -n $p | sha1sum; done
Generate insert statements that look like
insert into account (user_name, mail_address, password, administrator, registered_date, updated_date, group_account, full_name, removed) values ('username', 'email@address', 'SHA1 hashed password', FALSE, now(), now(), FALSE, 'full name', FALSE);
Make sure you keep the original passwords since you need to give those to the users.
If you are dealing with a small number of groups, then do it via the web interface. Otherwise:
group_account
field to true
.group_member
table using insert statements that look like:insert into group_member (group_name, user_name, manager) values ('group name from account table', 'username from account table', false);
Groups are useful for organising repositories, but can also be used to simplify access to a shared repository.
Make sure that you select the group in the drop down on the left when creating it. All members of the group will automatically get access.
You can transfer ownership to a group account using the Danger Zone option in the repository's settings.
I.e. downloading student submissions
SQL
select user_name, repository_name,last_activity_date from repository order by user_name ,last_activity_date desc
Regex
(.*)\t(.*)
Format string to turn result into GitBucket URIs
http://isgb.otago.ac.nz:8081/info323/git/$1/$2.git
Script for cloning
#IFS is field separator used by 'for', so spaces will cause issues if IFS is left at default (thanks Chris). IFS=" " for line in `cat repos.txt` ; do student=`echo $line | cut -d ' ' -f 1` repo=`echo $line | cut -d ' ' -f 2` echo Student: $student Repo: $repo mkdir $student cd $student git clone $repo cd - done
curl \ --cookie JSESSIONID=$sessionid \ --request POST \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data "owner=$owner&name=$repo_name&description=$repo_description&isPrivate=true&createReadme=on" \ --url http://gitbucketserver.wherever.com:8080/newOmit the
createReadme=on
part completely if you don't want a README.md created.