Rating:

## [See original writeup on site](https://barelycompetent.dev/post/ctfs/2021-04-11-ritsecctf/#1597)

### 1597
> ... as in https://xkcd.com/1597/
>
> http://git.ritsec.club:7000/1597.git/

We're given a website, with a publicly exposed git directory.

Clone it locally:

```bash
git clone http://git.ritsec.club:7000/1597.git/
```

cd into it. We see an empty `flag.txt` file. Checking the git history, we see:

```
git --no-pager log
commit dcc402050827e92dbcf2578e24f2cba76f34229c (HEAD -> master, origin/master, origin/HEAD)
Author: knif3 <[email protected]>
Date: Fri Apr 9 05:49:00 2021 +0000

Updated the flag

commit bb7917f300dd7ba1e5b45055dc802a8e4e3f19e5
Author: knif3 <[email protected]>
Date: Fri Apr 9 05:49:00 2021 +0000

Initial Commit
```

Checkout out the original commit, and cat flag file:

```bash
git checkout bb7917f300dd7ba1e5b45055dc802a8e4e3f19e5

cat flag.txt
Your princess is in another castle
```

OK, slightly larger search:

```bash
git --no-pager rev-list --all | (
while read revision; do
git --no-pager grep -F 'RS' $revision
done
)
```

Which yields the flag:

```
b123f674a07eaf5914eda8845d86b5219fc1de11:flag.txt:RS{git_is_just_a_tre3_with_lots_of_branches}
```

Flag is `RS{git_is_just_a_tre3_with_lots_of_branches}`.

Original writeup (https://barelycompetent.dev/post/ctfs/2021-04-11-ritsecctf/#1597).