summaryrefslogtreecommitdiff
path: root/doc/forum/Multiple_repos_on_same_path/comment_1_67ed823c4c40f5acf12b48eb75d7afa8._comment
blob: 5ab93d9ed50fc5c44d47c11a8f0f88be47166082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[[!comment format=mdwn
 username="https://sunny256.wordpress.com/"
 nickname="sunny256"
 subject="Create symlink in the root directory"
 date="2015-05-12T13:04:18Z"
 content="""
My way of dealing with this is to create a symlink in the root directory that point to the root directory, like

[[!format sh \"\"\"
$ cd /
$ sudo ln -sv . compname
[sudo] password for sunny: hunter2
'compname' -> '.'
$ ls -l compname
lrwxrwxrwx 1 root root 1 May 12 14:52 compname -> .
$
\"\"\"]]

where `compname` is the hostname for the computer. Now you can create paths like

[[!format sh \"\"\"
git remote add comp-a /comp-a/home/my_user/data/repo
git remote add comp-b /comp-b/home/my_user/data/repo
\"\"\"]]

This is also useful in other scripts where fetching data from the right directory on the wrong computer is bad. Also, this is a cheap way for a script to determine which computer it's running on:

[[!format sh \"\"\"
test -L \"/comp-a\" && echo Running on computer comp-a
\"\"\"]]

"""]]