Git/GitHub setup. You may have completed this while following along with lecture. You don't need to do this again.
-
Go to GitHub and create a free account.
-
You may have completed this while following along with lecture. You don't need to do this again. Look back at the notes and create your SSH key and add it to your github account. Notes for key creation
$ ssh-keygen -t ed25519 -C "your_email@example.com"
> Enter a file in which to save the key (/Users/YOU/.ssh/id_ALGORITHM: [Press enter]
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ vi ~/.ssh/config
Host *
IdentityFile ~/.ssh/id_ed25519
Skip if you already completed this: Add to your GitHub.com account: Settings --> SSH and GPC Keys --> Click "New SSH Key"
Paste the contents of your public "Lock" to GitHub with a title
cat ~/.ssh/id_ed25519.pub
- You may have completed this while following along with lecture. You don't need to do this again.
Create your first repository for your problem set code. Notes for repository creation.
NOTE: Don't create a repository inside of another repostitory.
- Move to your home directory (
cd ~), then create a new Repository by clicking "New" on the repository github page. https://github.com/YOURUSERNAME/repositories - Create a local (your machine) directory with
mkdir PFB_problemsets. - move into the new directory with
cd PFB_problemsets - start setting up your repository with the code produced by github. Start with
git init. - Don't
git initin your home directory. Make a new directory mentioned above (PFB_problemsets), change directory into PFB_problemsets, thengit init - Now link it to your remote repository with
git remote addusing the ssh URL.
- Move to your home directory (
-
Move any files you created for Unix_01 Problem set that are not already in your local problemset git repository to your local repository (PFB_problemsets). You can use the
mvcommand. -
Push all the new files in your local repository to your remote repository
git statusto see all the files you need to addgit add <filename>orgit add <filename1> <filename2> <filename3> ...git commit -m 'adding unix01 problem set files'git push- Visit the your GitHub repository website (on github.com) and see the files from your local repository that you just pushed up to your remote repository.
-
Create a directory call
filesin your PFB_problemsets directory. -
Move the file you renamed (in Unix01 problem set) from
sequences.nt.fatocancer_genes.fastato yourfilesdirectory -
ADD/COMMIT/PUSH
cancer_genes.fastato your remote repository
git add files/cancer_genes.fastagit commit -m 'adding cancer_genes.fasta'git push- Visit the your GitHub repository website (on github.com) and see the file from your local repository that you just pushed up to your remote repository.
- Using your vi text editor create a fasta file and name it
mysequences.txt. Make sure it ends up in your problem sets files directory.
This is fasta file format:
>seqName description
ATGGCGTCTTGGCCTTAAAAGCTC
GGCGTCTTGGCCTTAAAAGCTCAT
ATTCTTGGCCTTAAATTGGCCTTG
- add 10 lines of sequence
- delete a line
- insert a new line at line 4
- Copy line 5
- Paste this line above line 2
- set to view line numbers
- Cut line 3 and paste below line 6
- Go to line 4
- delete a line
- undo your last delete
- search for
CTT - find next occurrence of
CTT - Save and exit
-
ADD/COMMIT/PUSH
mysequences.txtto your remote. -
Create a directory called
fastasinside your problem_sets directory. (Hint: use mkdir) -
Copy the fasta file that you renamed to
cancer_genes.fastato the fasta directory. -
Verify that the file is within the fasta directory.
-
Delete the the original file that you used for copying.
-
Sync your remote repo with your local repo. Make sure to add each file you changed or use
git add <filename>. Don't forget to commit and push. -
Practice with
git rm
- Create a file named
oopsand add a few characters of content. - Save and Exit.
- Add/Commit/Push this file
git rm oopsgit commit -m 'removing oops'git push
- Practice with
rm. Can you spot the little difference fromgit rm
- Create a file named
oops2. add some content. save and exit - Add/Commit/Push this file
rm oops2git add oops2git commit -m 'removing oops2'git push
- Imagine this: You created a file,
git addit, but then realize you don't want to commit it. What do you do? from google search
- Create a file named
never. git add nevergit reset never
- Read the man page for
rmandcpto find out how to remove and copy a directory. - Print out your history and redirect it to a file called
unixBasics.history.txt - Open your history file with your text editor and delete any lines you do not want to keep. See this google search for info on deleting entire lines in vi.
- Make sure all your files are synced with your remote repository. (
git status) - Here is a way to ENSURE that you don't mistakenly commit a large file. Get help from TA if you do not know where your .git directory is
cd ~/PFB_problemsets/.git/hooks/
curl -O https://raw.githubusercontent.com/prog4biol/pfb2025/master/setup/pre-commit