Git¶
All template repositories, examples, tools, libraries and documentation can be found on the BFH TI GitLab server in the Leguan Organization.
Set up GitLab Account¶
Go to https://gitlab.ti.bfh.ch and log in with your regular BFH credentials
- Create an SSH key and put it on GitLab
Guide on how to create an SSH Key: https://gitlab.ti.bfh.ch/help/user/ssh.md
Settings page to submit key to GitLab: https://gitlab.ti.bfh.ch/-/profile/keys
To test whether the key was setup correctly on both your system and GitLab, enter the following command in your Terminal:
$ ssh git@gitlab.ti.bfh.ch
Welcome to GitLab, @<USERNAME>!
Connection to gitlab.ti.bfh.ch closed.
Get repository URL¶
Clone via Web-UI¶
The template project can be imported into your personal GitLab-Workspace.
Enter the URL to the repository into the Git repository URL
field and your BFH username and password into the two fields below.
Finally, you need to enter a name for your project at the bottom.
Clone locally via SmartGit¶
To work locally with Git, it’s recommended to use a GUI client such as GitKraken, GitFork or SmartGit.
However it’s also possible to use the git
command line tool directly.
In SmartGit this can be done by choosing Repository -> Clone
and entering the previously copied path into the Repository URL
field.
GitKraken and GitFork work similarly.
Import project into STM32CubeIDE¶
After cloning a repository, you can directly import it into the STM32CubeIDE workspace.
File->Import…
Choose
Existing Projects into Workspace
Select
Browse…
and choose the project to importClick on
Import
Working with Git¶
To use git efficiently, every new distinct feature, bugfix or improvement should be saved on GitLab by creating a new commit and pushing it to the git server. You don’t need to create a new commit every time you modified a line. However, it’s best to create a commit every time you’ve finished a task and start working on another one.
To create a new commit, use one of the tools mentioned above. The following instructions are for SmartGit, however the other tools work identically.
Choose your repository
All changes that have been made since the last commit are now being displayed and can be checked
Once you’re sure they’re correct, enter a commit message that describes the changes you’ve made and click on
Commit
To upload the new change to the GitLab server, click on the
Push
buttonIf multiple people are working on the same repository, always click on
Pull
first to download and merge the latest changes with your local changes before creating a new commit and clicking onPush
again.
To learn more about git, read https://git-scm.com/