homely
homely copied to clipboard
Failed to init empty repo
Initialization of empty repo does not going well. So I have just installed homely (sudo pip3 install homely
) and have an empty GitHub repo to be used. homely add
is swearing:
$ homely add [email protected]:agrml/dotfiles.git
[Tue Mar 13 17:13:17 2018] HOME: /home/mikhail
[Tue Mar 13 17:13:17 2018] tmp: /tmp/tmpeyr29m2t/dotfiles
[Tue Mar 13 17:13:17 2018] Cloning [email protected]:agrml/dotfiles.git to tmp:/tmp/tmpeyr29m2t/dotfiles
[Tue Mar 13 17:13:17 2018] $ git clone [email protected]:agrml/dotfiles.git /tmp/tmpeyr29m2t/dotfiles
[Tue Mar 13 17:13:17 2018] &> Cloning into '/tmp/tmpeyr29m2t/dotfiles'...
[Tue Mar 13 17:13:20 2018] &> warning: You appear to have cloned an empty repository.
Traceback (most recent call last):
File "/home/mikhail/.local/bin/homely", line 11, in <module>
sys.exit(main())
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 346, in main
homely()
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 37, in proxy
command(**kwargs)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 99, in add
localrepo, needpull = addfromremote(repo, dest_path)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_ui.py", line 310, in addfromremote
tmprepoid = localrepo.getrepoid()
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_vcs/git.py", line 92, in getrepoid
raise RepoHasNoCommitsError()
homely._errors.RepoHasNoCommitsError
Why should it be disallowed? Ok, now the repo has a commit with readme. But homely still can't create dotfiles folder:
$ homely add [email protected]:agrml/dotfiles.git
[Tue Mar 13 17:19:52 2018] HOME: /home/mikhail
[Tue Mar 13 17:19:52 2018] tmp: /tmp/tmpwaucr_16/dotfiles
[Tue Mar 13 17:19:52 2018] Cloning [email protected]:agrml/dotfiles.git to tmp:/tmp/tmpwaucr_16/dotfiles
[Tue Mar 13 17:19:52 2018] $ git clone [email protected]:agrml/dotfiles.git /tmp/tmpwaucr_16/dotfiles
[Tue Mar 13 17:19:52 2018] &> Cloning into '/tmp/tmpwaucr_16/dotfiles'...
Warning: the RSA host key for 'github.com' differs from the key for the IP address '192.30.253.113'
Offending key for IP in /home/mikhail/.ssh/known_hosts:34
Matching host key in /home/mikhail/.ssh/known_hosts:41
Are you sure you want to continue connecting (yes/no)? yes
Traceback (most recent call last):
File "/home/mikhail/.local/bin/homely", line 11, in <module>
sys.exit(main())
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 346, in main
homely()
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 37, in proxy
command(**kwargs)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_cli.py", line 99, in add
localrepo, needpull = addfromremote(repo, dest_path)
File "/home/mikhail/.local/lib/python3.5/site-packages/homely/_ui.py", line 344, in addfromremote
os.rename(tmp, dest_path)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpwaucr_16/dotfiles' -> '/home/mikhail/dotfiles'
What am I doing wrong?
Ubuntu 16.04 (4.4.0-116-generic) x86-64. Homely 0.15.2 via pip3.
I'm having the same second issue. In my case it's likely because /tmp/ is not on the same partition as /home/. Per https://stackoverflow.com/questions/42392600/oserror-errno-18-invalid-cross-device-link the solution should be to switch from os.rename
to shutil.move
@phodge Wouldn't a
...
try:
os.rename(tmp, dest_path)
except OSError as e:
import errno
if e.errno == errno.EXDEV:
import shutils
shutil.move(tmp, dest_path)
do the trick in line 344? I know it's rather ugly to import in-place, but os.rename
won't copy cross-device, and i think to remember copy&delete wouldn't do it either...