Requirement: A project is managed in Git in CODESYS Git. Now you want to establish a link to a remote repository to synchronize there your commits with the commits of others.
-
Click the Git → Git Remotes command. In the “Git Remotes” view, click the [Add] button
. The “Add new Git Remote” dialog opens.
-
Specify the path and a name for the remote repository to be linked. Example: Alias Name: origin, URL: D:\git_remote.
-
Run the “Fetch” command
and then click the Git → Git Branches command to switch to the “Git Branches” view. Credentials are usually required to access a remote repository. Only if no valid credentials are found on the computer will the “Credentials needed” dialog for your input ⮫ “Dialog: Credentials needed”.
-
Select the “Remote (<n>)” filter. You see the remote branches.
-
Unselect the “Remote (<n>)” filter. Select the “Local (1)” filter. Select the master entry and click “Upstream Set”. If there is still no remote branch (origin/master) for the selected remote repository, then the following happens: The “Set Upstream Remote for Branch” dialog opens. The remote name origin is already predefined.
-
Click [OK] to confirm the entries. → The Tracking and Current options are selected for the master. In “Tracked Branch”, Name, origin/master is displayed. This means that the remote branch origin/master for the remote repository is created internally. This is only used as a representative: No work is done directly on this branch.
-
Select the master and click [Push]. Select the “Remote (1)” filter. Now the representative branch origin/master under “Git Branches Remote (1)” is also displayed. The link from the local master to the remote repository is established by means of its representative origin/master.
-
In the “Git Branches Local (<1>) ”view, you can now use the “Track branch” command to link the local branch (master) of the Git repository to the new remote branch of the remote repository.