Skip to content

Commit e387bf9

Browse files
committed
deploy: 67ac848
1 parent 4e724e1 commit e387bf9

File tree

3 files changed

+78
-64
lines changed

3 files changed

+78
-64
lines changed

_sources/git.md.txt

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,26 @@ LICENSE annex.largefiles=nothing
3434

3535
## Credential Helper
3636

37-
Using openneuro-cli, git can be configured to automatically use your OpenNeuro credentials to allow access to datasets. This is the preferred method for authenticating regular git access. An advanced method of issuing a key is documented below if you cannot use the [git credential helper](https://git-scm.com/docs/gitcredentials) for your use case.
37+
Using [@openneuro/cli](https://jsr.io/@openneuro/cli), git can be configured to automatically use your OpenNeuro credentials to allow access to datasets. This is the preferred method for authenticating regular git access. An advanced method of issuing a key is documented below if you cannot use the [git credential helper](https://git-scm.com/docs/gitcredentials) for your use case.
3838

3939
### Setup
4040

41-
Once you have openneuro-cli installed and you've logged in with `openneuro login`, you can configure git to automatically use your login.
41+
Once you have logged in with `deno run -A jsr:@openneuro/cli`, you can configure git to automatically use your login.
4242

4343
```shell
4444
# This allows the helper to identify which dataset you are accessing automatically and issue a key for that dataset
45-
git config credential.useHttpPath true
46-
# Point git at the openneuro-cli tool (this must be an absolute path)
47-
git config credential.helper "/path/to/openneuro git-credential"
45+
git config --global credential.https://openneuro.org.useHttpPath true
46+
# Point git at the @openneuro/cli tool (this must be an absolute path)
47+
git config --global credential.https://openneuro.org.helper "/path/to/deno -A jsr:@openneuro/cli git-credential"
4848
```
4949

50-
Alternatively openneuro-cli can be given the name `git-credential-openneuro` and this shorter command will work.
50+
If you are using [Git Credential Manager](https://github.com/git-ecosystem/git-credential-manager) add the provider entry to avoid duplicating entries.
5151

5252
```shell
53-
git config credential.helper "openneuro"
54-
```
55-
56-
This will configure these options for one repository.
57-
58-
To enable for all OpenNeuro repositories add this to your [git configuration file](https://git-scm.com/docs/git-config#FILES).
59-
60-
```cfg
61-
[credential "https://openneuro.org"]
62-
useHttpPath = true
63-
helper = "/path/to/openneuro git-credential"
53+
git config credential.https://openneuro.org.provider generic
6454
```
6555

66-
If you are using [Git Credential Manager](https://github.com/git-ecosystem/git-credential-manager) add the provider entry to avoid duplicating entries.
56+
Or by modifying your .gitconfig:
6757

6858
```cfg
6959
[credential "https://openneuro.org"]
@@ -76,20 +66,20 @@ If you are using [Git Credential Manager](https://github.com/git-ecosystem/git-c
7666

7767
Most datalad or git operations will work as expected but there are a few limitations. Force pushes or unrelated history will be rejected. Annexed data is accepted but only via the git transport, using other annexes will result in unreachable files or failed validation due to missing data.
7868

79-
To download a new dataset using the credential helper you can start with an empty repo and then configure that repo.
69+
Once the helper has been configured clone a repo:
8070

8171
```shell
82-
mkdir ds000001
72+
# You can use git clone...
73+
git clone https://openneuro.org/git/0/ds0000001
74+
# Or datalad install
75+
datalad install https://openneuro.org/git/0/ds0000001
8376
cd ds0000001
84-
git init
85-
git remote add origin https://openneuro.org/git/0/ds0000001
86-
# Follow the above steps to setup the credential helper
87-
git pull origin master
88-
git pull origin git-annex:git-annex
8977
# From here you can treat this like a datalad dataset and export back to OpenNeuro to deploy changes
9078
```
9179

92-
When you are ready to push changes, make sure to validate them before attempting to push. OpenNeuro will reject some invalid pushes but cannot run the full bids-validator until after your changes have been pushed.
80+
When you are ready to push changes, make sure to validate them before attempting to push. OpenNeuro runs a limited version of BIDS validation on pushes and will reject datasets that cannot pass validation of the file tree. File contents are validated only after upload.
81+
82+
To push annexed files, see `Configuring OpenNeuro special remote` below.
9383

9484
### Advanced authentication
9585

@@ -115,25 +105,43 @@ For private datasets or to add new data with DataLad or git-annex, a special rem
115105

116106
### Configuring OpenNeuro special remote
117107

108+
```shell
109+
# A script is provided to wrap the CLI as a special remote
110+
curl https://raw.githubusercontent.com/OpenNeuroOrg/openneuro/refs/heads/master/bin/git-annex-remote-openneuro -o git-annex-remote-openneuro
111+
# Make this executable and move this script to your path
112+
chmod +x git-annex-remote-openneuro
113+
```
114+
115+
Deno compile can be used if a single binary without network access is needed:
116+
117+
```shell
118+
# This will create a `git-annex-remote-openneuro` executable you add to your path
119+
deno compile -A --output git-annex-remote-openneuro jsr:@openneuro/cli
120+
```
121+
118122
Obtain the URL from the dataset page and run initremote (or enableremote if you need to update it).
119123

120124
```shell
121-
# Make sure openneuro-cli is installed and available in your path
122125
# You should see 'VERSION 1' 'EXTENSIONS' if this is working
123-
echo "EXTENSIONS" | git-annex-remote-openneuro
126+
echo "EXTENSIONS" | deno run -A jsr:@openneuro/cli special-remote
124127
# Configure the remote with the URL for your dataset
125128
git annex initremote openneuro type=external externaltype=openneuro encryption=none url=https://openneuro.org/git/0/ds0000001
126129
```
127130

128-
After this you can use regular git-annex or datalad commands to upload or download any annexed files by using the openneuro remote.
131+
To download annexed objects from the remote, you may need to manually ask git-annex update the local state of the OpenNeuro remote. You can force this update for all files:
129132

130133
```shell
131-
# To upload any annexed objects to the remote
132-
git annex copy --to openneuro
134+
git annex fsck --fast --from openneuro
133135
```
134136

135-
To download annexed objects from the remote, you may need to manually ask git-annex update the local state of the OpenNeuro remote. You can force this update for all files:
137+
After this you can use regular git-annex or datalad commands to upload or download any annexed files by using the openneuro remote.
136138

137139
```shell
138-
git annex fsck --fast --from openneuro
140+
# Download any annexed objects
141+
datalad get .
142+
```
143+
144+
```shell
145+
# To upload any annexed objects to the remote
146+
git annex copy --to openneuro
139147
```

git.html

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -289,28 +289,21 @@ <h2>Repository conventions<a class="headerlink" href="#repository-conventions" t
289289
</section>
290290
<section id="credential-helper">
291291
<h2>Credential Helper<a class="headerlink" href="#credential-helper" title="Link to this heading"></a></h2>
292-
<p>Using openneuro-cli, git can be configured to automatically use your OpenNeuro credentials to allow access to datasets. This is the preferred method for authenticating regular git access. An advanced method of issuing a key is documented below if you cannot use the <a class="reference external" href="https://git-scm.com/docs/gitcredentials">git credential helper</a> for your use case.</p>
292+
<p>Using <a class="reference external" href="https://jsr.io/&#64;openneuro/cli">&#64;openneuro/cli</a>, git can be configured to automatically use your OpenNeuro credentials to allow access to datasets. This is the preferred method for authenticating regular git access. An advanced method of issuing a key is documented below if you cannot use the <a class="reference external" href="https://git-scm.com/docs/gitcredentials">git credential helper</a> for your use case.</p>
293293
<section id="setup">
294294
<h3>Setup<a class="headerlink" href="#setup" title="Link to this heading"></a></h3>
295-
<p>Once you have openneuro-cli installed and you’ve logged in with <code class="docutils literal notranslate"><span class="pre">openneuro</span> <span class="pre">login</span></code>, you can configure git to automatically use your login.</p>
295+
<p>Once you have logged in with <code class="docutils literal notranslate"><span class="pre">deno</span> <span class="pre">run</span> <span class="pre">-A</span> <span class="pre">jsr:&#64;openneuro/cli</span></code>, you can configure git to automatically use your login.</p>
296296
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># This allows the helper to identify which dataset you are accessing automatically and issue a key for that dataset</span>
297-
git<span class="w"> </span>config<span class="w"> </span>credential.useHttpPath<span class="w"> </span><span class="nb">true</span>
298-
<span class="c1"># Point git at the openneuro-cli tool (this must be an absolute path)</span>
299-
git<span class="w"> </span>config<span class="w"> </span>credential.helper<span class="w"> </span><span class="s2">&quot;/path/to/openneuro git-credential&quot;</span>
297+
git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>credential.https://openneuro.org.useHttpPath<span class="w"> </span><span class="nb">true</span>
298+
<span class="c1"># Point git at the @openneuro/cli tool (this must be an absolute path)</span>
299+
git<span class="w"> </span>config<span class="w"> </span>--global<span class="w"> </span>credential.https://openneuro.org.helper<span class="w"> </span><span class="s2">&quot;/path/to/deno -A jsr:@openneuro/cli git-credential&quot;</span>
300300
</pre></div>
301301
</div>
302-
<p>Alternatively openneuro-cli can be given the name <code class="docutils literal notranslate"><span class="pre">git-credential-openneuro</span></code> and this shorter command will work.</p>
303-
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>config<span class="w"> </span>credential.helper<span class="w"> </span><span class="s2">&quot;openneuro&quot;</span>
302+
<p>If you are using <a class="reference external" href="https://github.com/git-ecosystem/git-credential-manager">Git Credential Manager</a> add the provider entry to avoid duplicating entries.</p>
303+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>config<span class="w"> </span>credential.https://openneuro.org.provider<span class="w"> </span>generic
304304
</pre></div>
305305
</div>
306-
<p>This will configure these options for one repository.</p>
307-
<p>To enable for all OpenNeuro repositories add this to your <a class="reference external" href="https://git-scm.com/docs/git-config#FILES">git configuration file</a>.</p>
308-
<div class="highlight-cfg notranslate"><div class="highlight"><pre><span></span><span class="k">[credential &quot;https://openneuro.org&quot;]</span>
309-
<span class="w"> </span><span class="na">useHttpPath</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
310-
<span class="w"> </span><span class="na">helper</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;/path/to/openneuro git-credential&quot;</span>
311-
</pre></div>
312-
</div>
313-
<p>If you are using <a class="reference external" href="https://github.com/git-ecosystem/git-credential-manager">Git Credential Manager</a> add the provider entry to avoid duplicating entries.</p>
306+
<p>Or by modifying your .gitconfig:</p>
314307
<div class="highlight-cfg notranslate"><div class="highlight"><pre><span></span><span class="k">[credential &quot;https://openneuro.org&quot;]</span>
315308
<span class="w"> </span><span class="na">useHttpPath</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
316309
<span class="w"> </span><span class="na">provider</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">generic</span>
@@ -321,18 +314,17 @@ <h3>Setup<a class="headerlink" href="#setup" title="Link to this heading">¶</a>
321314
<section id="usage">
322315
<h3>Usage<a class="headerlink" href="#usage" title="Link to this heading"></a></h3>
323316
<p>Most datalad or git operations will work as expected but there are a few limitations. Force pushes or unrelated history will be rejected. Annexed data is accepted but only via the git transport, using other annexes will result in unreachable files or failed validation due to missing data.</p>
324-
<p>To download a new dataset using the credential helper you can start with an empty repo and then configure that repo.</p>
325-
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>mkdir<span class="w"> </span>ds000001
317+
<p>Once the helper has been configured clone a repo:</p>
318+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># You can use git clone...</span>
319+
git<span class="w"> </span>clone<span class="w"> </span>https://openneuro.org/git/0/ds0000001
320+
<span class="c1"># Or datalad install</span>
321+
datalad<span class="w"> </span>install<span class="w"> </span>https://openneuro.org/git/0/ds0000001
326322
<span class="nb">cd</span><span class="w"> </span>ds0000001
327-
git<span class="w"> </span>init
328-
git<span class="w"> </span>remote<span class="w"> </span>add<span class="w"> </span>origin<span class="w"> </span>https://openneuro.org/git/0/ds0000001
329-
<span class="c1"># Follow the above steps to setup the credential helper</span>
330-
git<span class="w"> </span>pull<span class="w"> </span>origin<span class="w"> </span>master
331-
git<span class="w"> </span>pull<span class="w"> </span>origin<span class="w"> </span>git-annex:git-annex
332323
<span class="c1"># From here you can treat this like a datalad dataset and export back to OpenNeuro to deploy changes</span>
333324
</pre></div>
334325
</div>
335-
<p>When you are ready to push changes, make sure to validate them before attempting to push. OpenNeuro will reject some invalid pushes but cannot run the full bids-validator until after your changes have been pushed.</p>
326+
<p>When you are ready to push changes, make sure to validate them before attempting to push. OpenNeuro runs a limited version of BIDS validation on pushes and will reject datasets that cannot pass validation of the file tree. File contents are validated only after upload.</p>
327+
<p>To push annexed files, see <code class="docutils literal notranslate"><span class="pre">Configuring</span> <span class="pre">OpenNeuro</span> <span class="pre">special</span> <span class="pre">remote</span></code> below.</p>
336328
</section>
337329
<section id="advanced-authentication">
338330
<h3>Advanced authentication<a class="headerlink" href="#advanced-authentication" title="Link to this heading"></a></h3>
@@ -356,21 +348,35 @@ <h2>git-annex special remote<a class="headerlink" href="#git-annex-special-remot
356348
<p>For private datasets or to add new data with DataLad or git-annex, a special remote is available to push data directly to OpenNeuro.</p>
357349
<section id="configuring-openneuro-special-remote">
358350
<h3>Configuring OpenNeuro special remote<a class="headerlink" href="#configuring-openneuro-special-remote" title="Link to this heading"></a></h3>
351+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># A script is provided to wrap the CLI as a special remote</span>
352+
curl<span class="w"> </span>https://raw.githubusercontent.com/OpenNeuroOrg/openneuro/refs/heads/master/bin/git-annex-remote-openneuro<span class="w"> </span>-o<span class="w"> </span>git-annex-remote-openneuro
353+
<span class="c1"># Make this executable and move this script to your path</span>
354+
chmod<span class="w"> </span>+x<span class="w"> </span>git-annex-remote-openneuro
355+
</pre></div>
356+
</div>
357+
<p>Deno compile can be used if a single binary without network access is needed:</p>
358+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># This will create a `git-annex-remote-openneuro` executable you add to your path</span>
359+
deno<span class="w"> </span>compile<span class="w"> </span>-A<span class="w"> </span>--output<span class="w"> </span>git-annex-remote-openneuro<span class="w"> </span>jsr:@openneuro/cli
360+
</pre></div>
361+
</div>
359362
<p>Obtain the URL from the dataset page and run initremote (or enableremote if you need to update it).</p>
360-
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># Make sure openneuro-cli is installed and available in your path</span>
361-
<span class="c1"># You should see &#39;VERSION 1&#39; &#39;EXTENSIONS&#39; if this is working</span>
362-
<span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;EXTENSIONS&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>git-annex-remote-openneuro
363+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># You should see &#39;VERSION 1&#39; &#39;EXTENSIONS&#39; if this is working</span>
364+
<span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;EXTENSIONS&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>deno<span class="w"> </span>run<span class="w"> </span>-A<span class="w"> </span>jsr:@openneuro/cli<span class="w"> </span>special-remote
363365
<span class="c1"># Configure the remote with the URL for your dataset</span>
364366
git<span class="w"> </span>annex<span class="w"> </span>initremote<span class="w"> </span>openneuro<span class="w"> </span><span class="nv">type</span><span class="o">=</span>external<span class="w"> </span><span class="nv">externaltype</span><span class="o">=</span>openneuro<span class="w"> </span><span class="nv">encryption</span><span class="o">=</span>none<span class="w"> </span><span class="nv">url</span><span class="o">=</span>https://openneuro.org/git/0/ds0000001
365367
</pre></div>
366368
</div>
369+
<p>To download annexed objects from the remote, you may need to manually ask git-annex update the local state of the OpenNeuro remote. You can force this update for all files:</p>
370+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>annex<span class="w"> </span>fsck<span class="w"> </span>--fast<span class="w"> </span>--from<span class="w"> </span>openneuro
371+
</pre></div>
372+
</div>
367373
<p>After this you can use regular git-annex or datalad commands to upload or download any annexed files by using the openneuro remote.</p>
368-
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># To upload any annexed objects to the remote</span>
369-
git<span class="w"> </span>annex<span class="w"> </span>copy<span class="w"> </span>--to<span class="w"> </span>openneuro
374+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># Download any annexed objects</span>
375+
datalad<span class="w"> </span>get<span class="w"> </span>.
370376
</pre></div>
371377
</div>
372-
<p>To download annexed objects from the remote, you may need to manually ask git-annex update the local state of the OpenNeuro remote. You can force this update for all files:</p>
373-
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>annex<span class="w"> </span>fsck<span class="w"> </span>--fast<span class="w"> </span>--from<span class="w"> </span>openneuro
378+
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span><span class="c1"># To upload any annexed objects to the remote</span>
379+
git<span class="w"> </span>annex<span class="w"> </span>copy<span class="w"> </span>--to<span class="w"> </span>openneuro
374380
</pre></div>
375381
</div>
376382
</section>

0 commit comments

Comments
 (0)