Skip to content

Commit 5e6337a

Browse files
Manually configure git when syncing templates (#3243)
* Manually add Git config for template sync Without these steps, `sudo -u foreman git config --global` fails with this error: error: could not lock config file /usr/share/foreman/.gitconfig: Permission denied * Minor edits and clarifications --------- Co-authored-by: Maximilian Kolb <mail@maximilian-kolb.de> (cherry picked from commit 9db6c8b)
1 parent 3287c30 commit 5e6337a

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

guides/common/modules/proc_synchronizing-templates-with-an-existing-repository.adoc

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,44 @@
44
Use this procedure to synchronize templates between your {ProjectServer} and an existing repository.
55

66
.Procedure
7-
. If you want to use HTTPS to connect to the repository and you use a self-signed certificate authentication on your Git server, validate the certificate:
7+
. If you want to use HTTPS to connect to the repository and you use a self-signed certificate authority (CA) on your Git server:
8+
.. Create a new directory under the `/usr/share/foreman/` directory to store the Git configuration for the certificate:
89
+
910
[options="nowrap" subs="+quotes,verbatim,attributes"]
1011
----
11-
# sudo -u foreman git config --global http.sslCAPath _Path_To_My_Certificate_
12+
# mkdir --parents /usr/share/foreman/.config/git
1213
----
13-
. If you want to use SSH to connect to the repository, perform the following steps:
14+
.. Create a file named `config` in the new directory:
15+
+
16+
[options="nowrap" subs="+quotes,verbatim,attributes"]
17+
----
18+
# touch /usr/share/foreman/.config/git/config
19+
----
20+
.. Allow the `foreman` user access to the `.config` directory:
21+
+
22+
[options="nowrap" subs="+quotes,verbatim,attributes"]
23+
----
24+
# chown --recursive foreman /usr/share/foreman/.config
25+
----
26+
.. Update the Git global configuration for the `foreman` user with the path to your self-signed CA certificate:
27+
+
28+
[options="nowrap" subs="+quotes,verbatim,attributes"]
29+
----
30+
# sudo --user foreman git config --global http.sslCAPath _Path_To_CA_Certificate_
31+
----
32+
. If you want to use SSH to connect to the repository:
1433
.. Create an SSH key pair if you do not already have it.
1534
Do not specify a passphrase.
1635
+
1736
----
18-
# sudo -u foreman ssh-keygen
37+
# sudo --user foreman ssh-keygen
1938
----
2039
.. Configure your version control server with the public key from your {Project}, which resides in `/usr/share/foreman/.ssh/id_rsa.pub`.
2140
.. Accept the Git SSH host key as the `foreman` user:
2241
+
2342
[subs="+quotes"]
2443
----
25-
# sudo -u foreman ssh _git.example.com_
44+
# sudo --user foreman ssh _git.example.com_
2645
----
2746
. Configure the TemplateSync plugin settings on a *TemplateSync* tab.
2847
.. Change the *Branch* setting to match the target branch on a Git server.

0 commit comments

Comments
 (0)