2015-08-09 14:12:47 +00:00
|
|
|
# NAME
|
|
|
|
|
|
|
|
git-annex addurl - add urls to annex
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
git annex addurl `[url ...]`
|
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
Downloads each url to its own file, which is added to the annex.
|
|
|
|
|
2018-06-17 18:46:22 +00:00
|
|
|
When `youtube-dl` is installed, it can be used to check for a video
|
|
|
|
embedded in a web page at the url, and that is added to the annex instead.
|
|
|
|
(However, this is disabled by default as it can be a security risk.
|
2019-05-30 16:43:40 +00:00
|
|
|
See the documentation of annex.security.allowed-ip-addresses
|
2018-06-17 18:46:22 +00:00
|
|
|
in [[git-annex]](1) for details.)
|
|
|
|
|
2019-11-11 17:15:01 +00:00
|
|
|
Special remotes can add other special handling of particular urls. For
|
|
|
|
example, the bittorrent special remotes makes urls to torrent files
|
|
|
|
(including magnet links) download the content of the torrent,
|
|
|
|
using `aria2c`.
|
2015-08-09 14:12:47 +00:00
|
|
|
|
|
|
|
Normally the filename is based on the full url, so will look like
|
|
|
|
"www.example.com_dir_subdir_bigfile". In some cases, addurl is able to
|
|
|
|
come up with a better filename based on other information. Options can also
|
|
|
|
be used to get better filenames.
|
|
|
|
|
|
|
|
# OPTIONS
|
|
|
|
|
|
|
|
* `--fast`
|
|
|
|
|
2015-08-19 16:24:55 +00:00
|
|
|
Avoid immediately downloading the url. The url is still checked
|
|
|
|
(via HEAD) to verify that it exists, and to get its size if possible.
|
2015-08-09 14:12:47 +00:00
|
|
|
|
|
|
|
* `--relaxed`
|
|
|
|
|
2017-11-28 21:17:40 +00:00
|
|
|
Don't immediately download the url, and avoid storing the size of the
|
|
|
|
url's content. This makes git-annex accept whatever content is there
|
2017-11-30 17:45:43 +00:00
|
|
|
at a future point.
|
2015-08-09 14:12:47 +00:00
|
|
|
|
2017-11-30 17:45:43 +00:00
|
|
|
This is the fastest option, but it still has to access the network
|
|
|
|
to check if the url contains embedded media. When adding large numbers
|
|
|
|
of urls, using `--relaxed --raw` is much faster.
|
|
|
|
|
2015-08-09 14:12:47 +00:00
|
|
|
* `--raw`
|
|
|
|
|
2017-11-28 18:05:58 +00:00
|
|
|
Prevent special handling of urls by youtube-dl, bittorrent, and other
|
2015-08-09 14:12:47 +00:00
|
|
|
special remotes. This will for example, make addurl
|
|
|
|
download the .torrent file and not the contents it points to.
|
|
|
|
|
|
|
|
* `--file=name`
|
|
|
|
|
|
|
|
Use with a filename that does not yet exist to add a new file
|
|
|
|
with the specified name and the content downloaded from the url.
|
|
|
|
|
|
|
|
If the file already exists, addurl will record that it can be downloaded
|
|
|
|
from the specified url(s).
|
|
|
|
|
addurl --preserve-filename and a few related changes
* addurl --preserve-filename: New option, uses server-provided filename
without any sanitization, but with some security checking.
Not yet implemented for remotes other than the web.
* addurl, importfeed: Avoid adding filenames with leading '.', instead
it will be replaced with '_'.
This might be considered a security fix, but a CVE seems unwattanted.
It was possible for addurl to create a dotfile, which could change
behavior of some program. It was also possible for a web server to say
the file name was ".git" or "foo/.git". That would not overrwrite the
.git directory, but would cause addurl to fail; of course git won't
add "foo/.git".
sanitizeFilePath is too opinionated to remain in Utility, so moved it.
The changes to mkSafeFilePath are because it used sanitizeFilePath.
In particular:
isDrive will never succeed, because "c:" gets munged to "c_"
".." gets sanitized now
".git" gets sanitized now
It will never be null, because sanitizeFilePath keeps the length
the same, and splitDirectories never returns a null path.
Also, on the off chance a web server suggests a filename of "",
ignore that, rather than trying to save to such a filename, which would
fail in some way.
2020-05-08 20:09:29 +00:00
|
|
|
* `--preserve-filename`
|
|
|
|
|
|
|
|
When the web server (or torrent, etc) provides a filename, use it as-is,
|
|
|
|
avoiding sanitizing unusual characters, or truncating it to length, or any
|
|
|
|
other modifications.
|
|
|
|
|
|
|
|
git-annex will still check the filename for safety, and if the filename
|
|
|
|
has a security problem such as path traversal or an escape sequence,
|
|
|
|
it will refuse to add it.
|
|
|
|
|
2015-08-09 14:12:47 +00:00
|
|
|
* `--pathdepth=N`
|
|
|
|
|
|
|
|
Rather than basing the filename on the whole url, this causes a path to
|
|
|
|
be constructed, starting at the specified depth within the path of the
|
|
|
|
url.
|
|
|
|
|
|
|
|
For example, adding the url http://www.example.com/dir/subdir/bigfile
|
|
|
|
with `--pathdepth=1` will use "dir/subdir/bigfile",
|
|
|
|
while `--pathdepth=3` will use "bigfile".
|
|
|
|
|
|
|
|
It can also be negative; `--pathdepth=-2` will use the last
|
|
|
|
two parts of the url.
|
|
|
|
|
|
|
|
* `--prefix=foo` `--suffix=bar`
|
|
|
|
|
|
|
|
Use to adjust the filenames that are created by addurl. For example,
|
|
|
|
`--suffix=.mp3` can be used to add an extension to the file.
|
|
|
|
|
Added --no-check-gitignore option for finer grained control than using --force.
add, addurl, importfeed, import: Added --no-check-gitignore option
for finer grained control than using --force.
(--force is used for too many different things, and at least one
of these also uses it for something else. I would like to reduce
--force's footprint until it only forces drops or a few other data
losses. For now, --force still disables checking ignores too.)
addunused: Don't check .gitignores when adding files. This is a behavior
change, but I justify it by analogy with git add of a gitignored file
adding it, asking to add all unused files back should add them all back,
not skip some. The old behavior was surprising.
In Command.Lock and Command.ReKey, CheckGitIgnore False does not change
behavior, it only makes explicit what is done. Since these commands are run
on annexed files, the file is already checked into git, so git add won't
check ignores.
2020-09-18 17:12:04 +00:00
|
|
|
* `--no-check-gitignore`
|
|
|
|
|
|
|
|
By default, gitignores are honored and it will refuse to download an
|
|
|
|
url to a file that would be ignored. This makes such files be added
|
|
|
|
despite any ignores.
|
|
|
|
|
2015-11-05 22:24:15 +00:00
|
|
|
* `--jobs=N` `-JN`
|
|
|
|
|
|
|
|
Enables parallel downloads when multiple urls are being added.
|
|
|
|
For example: `-J4`
|
|
|
|
|
2019-05-10 17:24:31 +00:00
|
|
|
Setting this to "cpus" will run one job per CPU core.
|
|
|
|
|
2015-12-21 16:57:13 +00:00
|
|
|
* `--batch`
|
|
|
|
|
|
|
|
Enables batch mode, in which lines containing urls to add are read from
|
|
|
|
stdin.
|
|
|
|
|
added -z
Added -z option to git-annex commands that use --batch, useful for
supporting filenames containing newlines.
It only controls input to --batch, the output will still be line delimited
unless --json or etc is used to get some other output. While git often
makes -z affect both input and output, I don't like trying them together,
and making it affect output would have been a significant complication,
and also git-annex output is generally not intended to be machine parsed,
unless using --json or a format option.
Commands that take pairs like "file key" still separate them with a space
in --batch mode. All such commands take care to support filenames with
spaces when parsing that, so there was no need to change it, and it would
have needed significant changes to the batch machinery to separate tose
with a null.
To make fromkey and registerurl support -z, I had to give them a --batch
option. The implicit batch mode they enter when not provided with input
parameters does not support -z as that would have complicated option
parsing. Seemed better to move these toward using the same --batch as
everything else, though the implicit batch mode can still be used.
This commit was sponsored by Ole-Morten Duesund on Patreon.
2018-09-20 20:09:21 +00:00
|
|
|
* `-z`
|
|
|
|
|
|
|
|
Makes the `--batch` input be delimited by nulls instead of the usual
|
|
|
|
newlines.
|
|
|
|
|
2015-12-22 16:20:39 +00:00
|
|
|
* `--with-files`
|
|
|
|
|
|
|
|
When batch mode is enabled, makes it parse lines of the form: "$url $file"
|
|
|
|
|
|
|
|
That adds the specified url to the specified file, downloading its
|
|
|
|
content if the file does not yet exist; the same as
|
|
|
|
`git annex addurl $url --file $file`
|
|
|
|
|
2016-01-13 18:25:30 +00:00
|
|
|
* `--json`
|
|
|
|
|
|
|
|
Enable JSON output. This is intended to be parsed by programs that use
|
|
|
|
git-annex. Each line of output is a JSON object.
|
|
|
|
|
2016-09-09 19:06:54 +00:00
|
|
|
* `--json-progress`
|
|
|
|
|
|
|
|
Include progress objects in JSON output.
|
|
|
|
|
2018-02-19 18:28:17 +00:00
|
|
|
* `--json-error-messages`
|
|
|
|
|
2018-02-19 19:33:59 +00:00
|
|
|
Messages that would normally be output to standard error are included in
|
|
|
|
the json instead.
|
2018-02-19 18:28:17 +00:00
|
|
|
|
2021-05-10 19:00:13 +00:00
|
|
|
* Also the [[git-annex-common-options]](1) can be used.
|
|
|
|
|
2016-01-25 17:41:21 +00:00
|
|
|
# CAVEATS
|
|
|
|
|
|
|
|
If annex.largefiles is configured, and does not match a file, `git annex
|
|
|
|
addurl` will add the non-large file directly to the git repository,
|
|
|
|
instead of to the annex. However, this is not done when --fast or --relaxed
|
|
|
|
is used.
|
|
|
|
|
2015-08-09 14:12:47 +00:00
|
|
|
# SEE ALSO
|
|
|
|
|
|
|
|
[[git-annex]](1)
|
|
|
|
|
|
|
|
[[git-annex-rmurl]](1)
|
|
|
|
|
|
|
|
[[git-annex-registerurl]](1)
|
|
|
|
|
|
|
|
[[git-annex-importfeed]](1)
|
|
|
|
|
|
|
|
# AUTHOR
|
|
|
|
|
|
|
|
Joey Hess <id@joeyh.name>
|
|
|
|
|
|
|
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|