Monday, December 13, 2021

A git (Windows) set-up in 2021

This can actually be used cross-platform to some degree.

Back in 2017, I have written this post to describe how I configured git on my machine to my convenience.

The years have passed, so there must be a better way of doing things by now, right ?

2021 set-up

Perhaps not better, but more suited to what I have at my disposal, a new tooling.

Git for windows.

I've ended up using the command line much more than I had expected initially.

https://git-scm.com/download/win

vscode

You can use vscode to work on a project. And vscode comes with a diff viewer. I've enjoyed using vscode and the plethora of plugins it offers. While VSCode does come with a git integration already, there are a few plugins that make life much better.

GitLens plugin for vscode

GitLens — Git supercharged - Visual Studio Marketplace

Git Graph plugin for vscode

Git Graph - Visual Studio Marketplace

SSH Config

So this part remained pretty much the same

If you'll be using git for work, you'll want to do this securely, so one approach would be to use ssh.

Create some ssh keys

Or at least one.
  1. First, go to your user account to make certain you don't already have some configured files that you would overwrite.
    • Open a Windows Explorer window and go to [%userprofile%/.ssh].
    • If you have an id_rsa file already created, don't just run the following steps; instead: adjust them to your needs: either rename the file in Explorer, or use a different file name in the commands.
  2. Open a terminal / command prompt and type
    • ssh-keygen -t rsa -b 2048 -C "gusti.email@address.com"
    • Generating public/private rsa key pair.
  3. Enter file in which to save the key (/c/Users/gusti/.ssh/id_rsa): /c/Users/gusti/.ssh/id_rsa
  4. For simplicity, you may leave the password empty, but it would not hurt to add one.
    • Enter passphrase (empty for no passphrase):
    • Enter same passphrase again:
  5. Your identification has been saved in /c/Users/gusti/.ssh/id_rsa.
  6. Your public key has been saved in /c/Users/gusti/.ssh/id_rsa.pub.

Assign the public key to your account

Upload the public ssh key (/c/Users/gusti/.ssh/id_rsa.pub) to your account on your git server.

Gitlab personal access tokens

When working with a gitlab-like server, you can configure a personal access token on https instead of using ssh

It's easy to start with and somewhat in a reverse order to the ssh, as you create it in the browser on the server and then download it.

Of course, you become responsible for copying and storing that access token. So store it somewhere safely.


The good thing is that you can use the tokens to also configure some Continuous Integration pipelines.

The not so nice  thing about the token is the way in which some commands get modified. Instead of using 

git clone https://gitserver.com/user/repo.git

you end up using

git clone https://user:token@gitserver.com/user/repo.git
So, I end up using something akin to
git clone https://gusti:BLA-tok3n_2trYOut@gitserver.com/user/repo.git

Some more configuration

Line endings on Windows
Line endings differ between Windows and Linux, and sharing code between developers on Windows and Linux is a pain without an automatic handling of the line endings.
Make sure you have the setting core.autocrlf set to true as suggested in this article on github.

Note: you can check what value the key already has, by opening a git bash / terminal, typing git config --list and searching for the core.autocrlf value.

 


 

Tuesday, May 02, 2017

My Git set-up

It took some time to get used to git, but it keeps taking more and more time to migrate others to git.
So here's a quick guide to help out with getting up to speed using git, specifically in corporate environments where you would also need some SSH configuration.

Get some tools

You don't have to stick to one single tool. I work on Windows. What I prefer to use for my work configuration is a combination of:
SourceTree
and
TortoiseGit

Why both?

Wednesday, April 26, 2017

PsPad and WinCC OA

Years have passed since my last entry related to WinCC OA ... or anything else for that matter.
In the mean-time WinCC OA received some incremental updates with new features and fixes, making it more pleasant to use.
Some of its newer scripting features include some object oriented support. And future scripting enhancements seem imminent, due to the reserved keywords.

My trusty PsPad editor is still with me and I still use it to write WinCC OA code.
In the mean-time, I joined the dark side and started preferring darker themed editors for writing code.
PsPad adjusted_darkness theme


Saturday, October 19, 2013

Building CEGUI

Building CEGUI

Building CEGUI requires some of the same steps we've seen when building Ogre. This tutorial is designed for CEGUI version 0.8.2. It might work successfully on other versions as well.

Clone the repository

    Clone the Hg repository found at https://bitbucket.org/cegui/cegui. You can do this by going to a folder of your choice in Windows Explorer, right clicking a window background in Windows Explorer, selecting TortoiseHg from the context menu and then Clone from the sub-menu.

    You should receive a smaller window where you can specify the details of the clone operation. Here you should specify the  source (https://bitbucket.org/cegui/cegui) and the destination (E.g. C:\code\cegui_08). Just make sure you add the name of the sub-folder to use. Mercurial will not create a sub-folder otherwise. You should see that the text box on the bottom side of the window is updated according to the changes you perform. You could run the command provided there in a cmd window to get the same results.

    It might take a few minutes for the repository to be downloaded. After the clone operation is completed, you should be able to see the files in the local directory.

Wednesday, October 16, 2013

Building the CEGUI dependencies

 Building the CEGUI dependencies

    Similar to OGRE, CEGUI also makes use of a set of dependencies that need to be built. However, there is a greater variety of configurable options. And this increased freedom of configuration comes at the cost of increased complexity.

Download the dependencies 

    The dependencies should be available for various versions. In this tutorial I shall assume that the version 0.8.2 is used for CEGUI. The dependency package for it should be here:
http://prdownloads.sourceforge.net/crayzedsgui/cegui-deps-0.8.x-src.zip?download

    If a new version of CEGUI is released, a dependency package for it should also be available. If it isn't, you can get the individual libraries, as you need them. You don't need all of them. Download the dependencies and decompress them on your local drive (E.g. c:\code\cegui-deps-0.8.x-src\)

Tuesday, October 15, 2013

Building OGRE

Building OGRE itself

Prerequisites

     You will need the following tools:
  • All the prerequisites from the tutorial on building the Ogre dependencies
  • The built binaries for the Ogre dependencies.
  • Boost

Building Boost

Building Boost

When it comes to Ogre, you may notice that there are several dependencies to the boost libraries. The  Boost libraries are used mainly to add thread support to Ogre. They are not mandatory and can be replaced by other thread libraries. But I shall treat them as the default Ogre thread provider.

Download the Boost library


    This example is for building Boost version 1.54, but it can easily be adapted to other versions as well. Just make sure to adapt the paths and any place where the version is mentioned. First, download boost, using one of the available distribution methods (zip, 7z, svn) : http://www.boost.org/users/download/, and place it in a local directory. If it is an archive, decompress it :-)

    For this tutorial, I chose to download the 7z archive and extract it to a local directory. E.g. [c:\code\boost_1_54_0].