Difference between revisions of "TheMagPiGit"

From eLinux.org
Jump to: navigation, search
(Using github)
(Setting up access)
Line 12: Line 12:
 
* The first step is to create a [https://github.com/ github] account.  Then for those on the MagPi layout team, email the editor for permission to join the github organisation.
 
* The first step is to create a [https://github.com/ github] account.  Then for those on the MagPi layout team, email the editor for permission to join the github organisation.
  
* Since the Raspberry Pi does not have a great deal of processor power, it is better to use the command line tools to access github.   
+
* Since the Raspberry Pi does not have a great deal of processor power, it is better to use the command line tools to access github.  For OSX and Windows there are GUI tools available for download on the github site.
  
* Once you have a github account, on your Raspberry Pi type:
+
 
 +
=== Tools for Raspberry Pi or VirtualBox ===
 +
 
 +
Several people would rather not read the [http://git-scm.com/book/en/ git book].  Therefore, some scripts were written to simplify the usage slightly.
 +
 
 +
* Download [https://www.dropbox.com/s/ydtv56zlod95ptg/mp-git-20120208.tar.gz mp-git-20120208.tar.gz] from the DropBox.
 +
* Unpack it,
 
<pre>
 
<pre>
git config --global user.name "John Doe"
+
tar xvfz mp-git-20120208.tar.gz
git config --global user.email J.Doe@machine.org
 
 
</pre>
 
</pre>
where the user name and email address should be replaced with your user name and email address.  This is a one time configuration stepThese settings are then stored in your ~/.gitconfig file.
+
* Install it,
 +
<pre>
 +
cd mp-git
 +
source install.sh
 +
</pre>
 +
* Then use the commands as neededThe commands are,
  
* The easiest way to use the command line tools is via an ssh key pair. Type,
+
==== mp-git-setup.sh ====
 +
 
 +
Type
 
<pre>
 
<pre>
ssh-keygen
+
mp-git-setup.sh
 
</pre>
 
</pre>
to create an ssh key pair and choose a secure password (upper and lower case letters, symbols and numbers without dictionary words)This is a one time configuration step, unless the password needs to be updated in the future.
+
to install and configure gitThe script has no action if the installation and configuration is already okay.  
  
* Then go to your github accountSelect account preferences. Then select "SSH Keys" from the left-hand menu. Click on "Add SSH key" and add your public key (~/.ssh/id_rsa.pub).  This is a one time configuration step, unless the public key needs to be updated (for a password change) or another public key needs to be added.
+
==== mp-git-clone.sh ====
 +
 
 +
Type
 +
<pre>
 +
mp-git-clone.sh
 +
</pre>
 +
to check out the shinything repositoryThe script will not check out the repository again if a local copy already exists in the present working directory.
 +
 
 +
==== mp-git-commit.sh ====
 +
 
 +
Type
 +
<pre>
 +
mp-git-commit.sh 'A message goes here'
 +
</pre>
 +
where the string 'A message goes here' should be replaced with a sensible and informative message.
 +
The script commits to the local repository, fetches and remote changes and then merges the local changes into the
 +
remote repository.
  
 
=== Using github ===
 
=== Using github ===

Revision as of 06:28, 8 February 2013

TheMagPi.png

Main Readers Authors Volunteers Sponsors Advertising Translations


Raspberry Pi & github

Setting up access

  • The first step is to create a github account. Then for those on the MagPi layout team, email the editor for permission to join the github organisation.
  • Since the Raspberry Pi does not have a great deal of processor power, it is better to use the command line tools to access github. For OSX and Windows there are GUI tools available for download on the github site.


Tools for Raspberry Pi or VirtualBox

Several people would rather not read the git book. Therefore, some scripts were written to simplify the usage slightly.

tar xvfz mp-git-20120208.tar.gz
  • Install it,
cd mp-git
source install.sh
  • Then use the commands as needed. The commands are,

mp-git-setup.sh

Type

mp-git-setup.sh 

to install and configure git. The script has no action if the installation and configuration is already okay.

mp-git-clone.sh

Type

mp-git-clone.sh

to check out the shinything repository. The script will not check out the repository again if a local copy already exists in the present working directory.

mp-git-commit.sh

Type

mp-git-commit.sh 'A message goes here'

where the string 'A message goes here' should be replaced with a sensible and informative message. The script commits to the local repository, fetches and remote changes and then merges the local changes into the remote repository.

Using github

  • At the start of an editing session (when you log into the Raspberry Pi), type:
ssh-agent
ssh-add

then enter your password for the ssh key. This step needs to be rebooted each time you log into the Raspberry Pi.

  • Then use the ssh read and write link from the github repository, e.g.:
git clone git@github.com:someorg/reponame.git 

this will create a folder called reponame. The clone operation clones the repository to the local disk.