Skip to content

Commit 627be18

Browse files
authored
Merge pull request #80 from datalad/exportdatacode_example
Exportdatacode example
2 parents 1b87408 + fc44669 commit 627be18

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

docs/source/exportdatacode.rst

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Export version-controlled data to OSF and code to Github
23
********************************************************
34

@@ -37,7 +38,7 @@ copying it will prevent your code from execution.
3738
$ datalad create collab_osf
3839
3940
After having created the dataset we want to populate it with some content (just
40-
like in the Handbook).
41+
like in the Handbook). Importantly we don't want to upload this file on Github, only on OSF - in the real world this could be your data that is too large to upload to Github.
4142

4243
.. code-block:: bash
4344
@@ -47,51 +48,48 @@ like in the Handbook).
4748
-m "add beginners guide on bash" \
4849
-O books/bash_guide.pdf
4950
50-
And we also want to add a text file, which will be saved on Github_.
51+
And we also want to add a text file, which will be saved on Github_ - in your case this could be the code you are using.
5152

5253
.. code-block:: bash
5354
54-
$ cat << EOT > example.txt
55-
This is just an example file just to show the different ways of saving data
56-
in a DataLad Dataset. EOT
57-
55+
$ mkdir code
56+
$ cd code
57+
$ echo "This is just an example file just to show the different ways of saving data in a DataLad Dataset." > example.txt
5858
$ datalad save --to-git -m "created an example.txt"
5959
6060
We now have a Dataset with one file that can be worked on using Github and one
6161
that should be tracked using `git-annex`.
6262

63-
Setting up Github Remote
64-
^^^^^^^^^^^^^^^^^^^^^^^^
65-
66-
We can set-up a Github Remote with the same name basically using
67-
68-
.. code-block:: bash
69-
70-
$ datalad create-sibling-github REPRONAME --github-login GITHUB_NAME
71-
$ git annex copy code/ --to github
72-
7363
Setting up the OSF Remote
7464
^^^^^^^^^^^^^^^^^^^^^^^^^
7565

7666
To use OSF as a storage, you need to provide either your OSF credentials or an OSF access token.
77-
You can create such a token in your account settings (`Personal access token` and then `Create token`), make sure to create a `full_write` token to be able to create OSF projects and upload data to OSF.
67+
You can create such a token in your account settings (`Personal access token` and then `Create token`), make sure to create a `full_write` token to be able to create OSF projects and upload data to OSF.
7868

7969
.. code-block:: bash
8070
8171
$ export OSF_TOKEN=YOUR_TOKEN_FROM_OSF.IO
8272
83-
We are now going to use datalad to create a sibling dataset on OSF - this will create a new dataset called `OSF_PROJECT_NAME` on the OSF account associated with the OSF token in `$OSF_TOKEN`.
73+
We are now going to use datalad to create a sibling dataset on OSF with name `osf` - this will create a new dataset called `OSF_PROJECT_NAME` on the OSF account associated with the OSF token in `$OSF_TOKEN`.
8474

8575
.. code-block:: bash
8676
87-
$ datalad create-sibling-osf OSF_PROJECT_NAME YOUR_OSF_REMOTE_NAME
77+
$ datalad create-sibling-osf -s osf OSF_PROJECT_NAME
78+
79+
Setting up Github Remote
80+
^^^^^^^^^^^^^^^^^^^^^^^^
8881

89-
And finally we are going to copy all files to this new OSF project.
82+
We can set-up a Github Remote with name `github` and include a publish dependency with OSF - that way, when we publish our dataset to Github, the data files get automatically uploaded to OSF.
9083

9184
.. code-block:: bash
9285
93-
$ git annex copy books/* --to YOUR_OSF_REMOTE_NAME
86+
$ datalad create-sibling-github REPRONAME -s github --github-login GITHUB_NAME --publish-depends osf
87+
$ datalad publish . --to github --transfer-data all
88+
89+
This will publish example.txt in code/ to Github and only add the folder structure and symbolic links for all other file; at the same time it will upload the data to OSF - this way you can let OSF handle your data and Github your code.
90+
9491

9592

9693
.. _OSF: https://www.osf.io/
9794
.. _Github: https://www.github.com/
95+

0 commit comments

Comments
 (0)