Repo

Setip of a new Python repository and sync it with Bitbucket.


1. Generate SSH Key

If not already done, generated an SSH key with the command:

ssh pi@192.168.178.26
ssh-keygen -t rsa -b 4096 -C "logistics@moehring.ch"

2. Add SSH Key to SSH Agent

Add the SSH private key to the SSH agent:

ssh-add ~/.ssh/id_rsa

In case an error like Could not open a connection to your authentication agent. run the following command to start the SSH agent:

eval "$(ssh-agent -s)"

This starts the agent and sets the necessary environment variables.


3. Copy the content of the public key

Copy the content of the public key (located at ~/.ssh/id_rsa.pub):

cat ~/.ssh/id_rsa.pub

4. Add the content to the Bitbucket account

Navigate to Bitbucket Settings > SSH keys and add a new SSH key with the content of the public key (see Bitbucket SSH keys).


5. Clone the repository

As a prereqisite install git, if not already installed:

sudo apt install git

Initially: clone the repository (for example raspi_catch_object) using the SSH URL:

ssh pi@192.168.178.26
cd /usr/local/logistics/Python/repo
git clone git@bitbucket.org:Logistics_Project/raspi_catch_object.git

6. Pull code from Bitbucket

Ongoing: Pull code from Bitbucket (according to Pull code from Bitbucket).

Change to the local directory:

cd /usr/local/logistics/Python/repo/raspi_catch_object

Check the status

git status

Discard all changes in the local directory

git restore .

Pull changes from Git

git pull --all