-- optimisation.
unless (fromMaybe False $ Git.Config.isBare r') $
setremote setRemoteBare False
+ -- When annex.url is set to a P2P http url,
+ -- store in remote.name.annexUrl
+ case Git.fromConfigValue <$> Git.Config.getMaybe (annexConfig "url") r' of
+ Just u | isP2PHttpProtocolUrl u ->
+ setremote (setConfig . annexUrlConfigKey) u
+ _ -> noop
return r'
Left err -> do
set_ignore "not usable by git-annex" False
, annexSyncMigrations :: Bool
, annexDebug :: Bool
, annexDebugFilter :: Maybe String
+ , annexUrl :: Maybe String
, annexWebOptions :: [String]
, annexYoutubeDlOptions :: [String]
, annexYoutubeDlCommand :: Maybe String
, annexSyncMigrations = getbool (annexConfig "syncmigrations") True
, annexDebug = getbool (annexConfig "debug") False
, annexDebugFilter = getmaybe (annexConfig "debugfilter")
+ , annexUrl = getmaybe (annexConfig "url")
, annexWebOptions = getwords (annexConfig "web-options")
, annexYoutubeDlOptions = getwords (annexConfig "youtube-dl-options")
, annexYoutubeDlCommand = getmaybe (annexConfig "youtube-dl-command")
After changing this config, you need to re-run `git-annex init` for it
to take effect.
+* `annex.url`
+
+ When a remote has a http url, the first time git-annex uses the remote
+ it will check if it can download its `.git/config` file. If it is able
+ to, and the file has this config set to an "annex+http" or "annex+https"
+ url, that url will be copied into `remote.<name>.annexUrl`.
+
* `annex.resolvemerge`
Set to false to prevent merge conflicts in the checked out branch
[[API|design/p2p_protocol_over_http]], and it does it
on a different port (9417 by default).
-All you need to do on the server is to arrange to run
-`git-annex p2phttp` in your repository as a daemon, or service.
-Note that it should not be run as root, but as whatever user owns the
-repository. It has several options you can use to configure it, including
-controlling who can access the repository.
-
-After cloning a repository, it's necessary to configure
-`remote.name.annexUrl` to an "annex+http" or "annex+https" url,
-so that git-annex knows where the API endpoint is.
-
-For example:
-
- git clone http://example.com/foo.git
- cd foo
- git config remote.origin.annexUrl annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
- git-annex get ...
-
-The last part of the "annex+http" url is the annex.uuid of the
-remote repository.
+You will need to arrange to run `git-annex p2phttp` in your repository as a
+daemon or service. Note that it should not be run as root, but as whatever
+user owns the repository. It has several options you can use to configure
+it, including controlling who can access the repository.
+
+So there are two web servers, and thus two different urls.
+A remote will have `remote.name.url` set to the http url
+that git will use, and also have `remote.name.annexUrl` set to the url
+that git-annex will use to talk to `git-annex p2phttp`. That url
+looks like this:
+
+ annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
+
+The "annex+http" (or "annex+https") indicates that it's a git-annex API
+url, which defaults to being on port 9417 unless a different port is set.
+And the last part of the url is the annex.uuid of the repository.
+
+It would be annoying if every user who cloned your repository
+had to set `remote.name.annexUrl` manually. So there's a way to automate it.
+In the git config file of the repository, set `annex.url` to the "annex+http"
+(or "annex+https") url. The first time it uses a http remote, git-annex
+downloads the git config file, and sets `remote.name.annexUrl` to the value
+of annex.url.
## work notes
-* When getting the remote .git/config of a http remote, check if
- annex.apiurl is set, and if so, set the remote's annexUrl automically.
-
- git-annex-p2phttp could automatically set annex.apiurl as well.
-
* An interrupted PUT to cluster that has a node that is a special remote
over http leaves open the connection to the cluster, so the next request
opens another one.