Tuesday, September 27, 2016

Raspberry Pi & Arch Linux - Day 6 - set up Git and create repository remotely




Problem 6: How to set up git environment

First, we need to install git. It is straightforward with pacman. What we want to focus today is how to initiate a repository using command line. this is a good place for a quick start with git.

Here is a extract from the Pro Git Book
1. configure git
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
2. initiate the directory of interest
$ git init
3. add files and commit
$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'

What we miss here is to create a repository remotely through command line. Of course, we can login our git account and create it manually but we want to stay with arch linux.

To create repository remotely, we need to refer to Git API. Here we give one working solution.

$ curl -u 'username' https://api.github.com/user/repos -d '{"name": "ProjectAutoCar", "description": "Project to build a auto car using Raspberry Pi"}'
$ git remote add origin https://github.com/meretciel/ProjectAutoCar.git

"proejctAutoCar" is the name of the repository. Now everything is ready and we can push the project to Github.
$ git push origin master


The ProjectAutoCar is what we want to do with Raspberry PI. We want to see if we can use Raspberry Pi to build a small auto-pilot car. It would be a great learning opportunity to have a better understanding of electronic components and basic machine learning algorithms.


We outline the basic structure (draft version) here and we will make changes as we get into details later.





No comments:

Post a Comment