Get familiar with git and github
Go to GitHub.com and create your GitHub account
Login to ansible-gY.lab.workalaya.net
Make sure you connect to this as your normal ("vmX-gY") user. You will use "sudo" where specific commands need to be run as root. It is good practice to do this.
you do not need perform this step as git package has already been installed
vmX-gY@ansible-gY:~$ sudo apt-get install git
Set up git with your user name and email.
vmX-gY@ansible-gY:~$ git config --global user.name "Your name here"
vmX-gY@ansible-gY:~$ git config --global user.email "your_email@example.com"
Generate SSH key
vmX-gY@ansible-gY:~$ ssh-keygen -t rsa -C "NMM lab key for npNOG5"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/vmX-gY/.ssh/id_rsa): <Press Enter>
Enter passphrase (empty for no passphrase): <Press Enter>
Enter same passphrase again: <Press Enter>
Your identification has been saved in /home/vmX-gY/.ssh/id_rsa.
Your public key has been saved in /home/vmX-gY/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:UOy7725TVUWeef3ywOdHZMDq8x+yikUKbSR+dSpW+Oo NMM lab key for npNOG5
The key's randomart image is:
+---[RSA 2048]----+
| .. ...+|
| .. . .o=|
| .o o o o +*|
| ..= + +..oo|
| oSB = .+ +|
| * = + B |
| + o + .+|
| o = + o|
| E+o.. ..|
+----[SHA256]-----+
Copy your public key (the contents of the newly-created id_rsa.pub file) into your clipboard.
vmX-gY@ansible-gY:~$ cat .ssh/id_rsa.pub
and copy its content to GitHub Account
Go to your github Account Settings
Click “SSH and GPG Keys” on the left.
Click “New SSH Key” on the right.
Add a label (like “My laptop”) and paste the public key into the big text box.
In a terminal/shell, type the following to test it:
vmX-gY@ansible-gY:~/$ ssh -T git@github.com
If it says something like the following, it worked:
Hi username! You've successfully authenticated, but Github does not provide shell access.
Your first instinct, when you start to do something new, should be git init. You’re starting to write a new paper, you’re writing a bit of code to do a computer simulation, you’re mucking around with some new data … anything: think git init.
Say you’ve just got some data from a collaborator and are about to start exploring it.
Create a directory to contain the project.
vmX-gY@ansible-gY:~/$ mkdir git-exercise1
Go into the new directory.
vmX-gY@ansible-gY:~/$ cd git-exercise1
Type git init.
vmX-gY@ansible-gY:~/git-exercise1$ git init .
Create some files.
vmX-gY@ansible-gY:~/git-exercise1$ vi readme
this is a readme file.
save and exit
Type git add to add the files.
vmX-gY@ansible-gY:~/git-exercise1$ git add .
Type git commit.
vmX-gY@ansible-gY:~/git-exercise1$ git commit
it prompts for commit message, type commit message
Initial Commit
save and exit, should see similar output
[master (root-commit) c362bef] Initial Commit
1 file changed, 1 insertion(+)
create mode 100644 readme
Say you’ve got an existing project that you want to start tracking with git.
First we create project directory and some files as
vmX-gY@ansible-gY:~/git-exercise1$ cd
vmX-gY@ansible-gY:~$ mkdir git-exersise2
vmX-gY@ansible-gY:~$ cd git-exersise2
vmX-gY@ansible-gY:~/git-exercise1$ cat > readme << _EOF_
this is a readme file.
_EOF_
Type git init.
vmX-gY@ansible-gY:~/git-exercise2$ git init .
Type git add to add the files.
vmX-gY@ansible-gY:~/git-exercise2$ git add .
Type git commit.
vmX-gY@ansible-gY:~/git-exercise2$ git commit
it prompts for commit message, type commit message
Initial Commit
save and exit, should see similar output
[master (root-commit) c362bef] Initial Commit
1 file changed, 1 insertion(+)
create mode 100644 readme
You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.
npnog5-nmm-first
private
as repository typeSSH
buttonNow, follow the second set of instructions, “Push an existing repository from the command line”
vmX-gY@ansible-gY:~/git-exercise2$ git remote add origin git@github.com:username/npnog5-nmm-first.git
vmX-gY@ansible-gY:~/git-exercise2$ git push -u origin master
Now explore your repository on GitHub.