aboutsummaryrefslogtreecommitdiff
path: root/cgit/ssh/git-shell-commands/fork
blob: d09985ad00d5ecb665aec19c40cc6c45a5040912 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env sh

set -eu

. "$(dirname $0)/_utils/input.sh"

remote_host="git.ediblemonad.dev"
owner_info="Akshay Nair <phenax5@gmail.com>"

repo_name="$(input_repo_name)";
repo_dir="/git/${repo_name}.git"

if [ -d "$repo_dir" ]; then
  echo "Error: $repo_name already exists" 1>&2
  exit 1;
fi

description="$(input_repo_description "$repo_dir")"
remote_repo_url="$(input_repo_remote_url)";

git clone --bare "$remote_repo_url" "$repo_dir"

cd "$repo_dir"
echo "Fork of $remote_repo_url" > description
echo "$owner_info" > owner_info

echo "git@${remote_host}:${repo_dir}"