forked from jxtx/mac-dev-playbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
github-setup.sh
59 lines (51 loc) · 1.84 KB
/
github-setup.sh
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
username=#FILLIN"First Last"
githubname=#FILLIN"githubusername"
email=#FILLIN"JHEDID@jhu.edu"
token=#FILLIN"token"
year=2023
#git config
git config --global user.name $username
git config --global user.email $email
git config --global github.user $githubname
git config --global github.token $token
git config --global commit.gpgsign false
git config --global core.editor "nano -w"
git config --global pull.merge true
git config --global pull.rebase true
echo "export GH_TOKEN=${token}" >> ~/.bash_profile
export GH_TOKEN=${token}
gh auth setup-git
# Create qbbYEAR-answers directory
reponame=qbb${year}-answers
mkdir ~/${reponame}
cd ~/${reponame}
echo "# QBB${year} repository" > README.md
echo *.bam > .gitignore #overwrite file in case script is run more than once
for word in *.bai *.bcf *.bed *.bg *.bedgraph *.bw *.bigwig *.faa *.fastq *.fasta *.fa *.fai *.fna *.fq *.fra *.gff* *.gtf *.gz *.h5 *.sam *.seq *.tgz *.tbz *.tbz2 *.vcf
do
echo $word >> .gitignore
done
#git add directory as a repo
git init
git add .gitignore README.md
git commit -m "initial commit"
git branch -M main
git remote add origin https://github.com/${githubname}/${reponame}.git
curl -u ${githubname}:${token} https://api.github.com/user/repos -d "{\"name\": \"${reponame}\"}"
git push -u origin main --force
#Add collaborators
##method curl: https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator
for collaborator in andrew-bortvin cutsort msauria rmccoy7541 schidambaran Merlin2333 mfisada
do
curl \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${token}" \
"https://api.github.com/repos/${githubname}/${reponame}/collaborators/${collaborator}" \
-d ''
done
# clone cmdb-quantbio repo
cd ~
git clone https://github.com/bxlab/cmdb-quantbio.git
chmod -R a=r cmdb-quantbio #only read access