summaryrefslogtreecommitdiff
path: root/doc/bugs/How_can_I_solve_a_non-fast-forward_push_without_using_the_assistant__63__.mdwn
blob: 69b0c4116be2570e1c4220020fb1d6f6756d25e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
### Please describe the problem.

I use both the assistant and the command line. Unfortunately I often end up
in a state where I cannot do a "git annex sync" (it fails as described below)
and I have to use the assistant to synchronize things to make the sync work. I
would like to know how to do the same thing using only the command line.

### What steps will reproduce the problem?

This problem involves two repos: a local, indirect mode, manual group, repo, and
a ssh remote archive group bare repo (with full git annex available
remotely). The local repo is "top" and the remote one is "mini_archive".

I start with the assistant not running, and the two repos in sync. Note that the
remote server cannot directly contact the local repo.

local:

    schmitta@top ~/D/annex (master)> git annex sync
    commit
    ok
    pull mini_archive 
    ok

remote:

    schmitta@mini ~/a/archive> git annex sync
    commit
    ok

I then add a file locally and try to sync, getting a problem on mini_archive:

    schmitta@top ~/D/annex (master)> git annex add videos/Minecraft/Icy\ and\ FlowerChild\ Play\ -\ Better\ Than\ Wolves\ 3-qg6LVTcDl4Y.mp4 
    add videos/Minecraft/Icy and FlowerChild Play - Better Than Wolves 3-qg6LVTcDl4Y.mp4 (checksum...) ok
    (Recording state in git...)
    schmitta@top ~/D/annex (master)> git annex sync
    commit
    ok
    pull mini_archive 
    ok
    push mini_archive 
    Counting objects: 15, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (10/10), done.
    Writing objects: 100% (10/10), 1.01 KiB | 0 bytes/s, done.
    Total 10 (delta 4), reused 0 (delta 0)
    remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
    To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
       a5b002b..dde2626  master -> synced/master
     ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
    error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
    failed
    git-annex: sync: 1 failed

I try to merge and sync on the remote (I assume sync also does merge, but I'm
not sure).

    schmitta@mini ~/a/archive> git annex merge
    merge git-annex ok
    schmitta@mini ~/a/archive> git annex sync
    commit
    ok

Back on the local machine, I still have the conflict.

    schmitta@top ~/D/annex (master) [1]> git annex sync
    commit
    ok
    pull mini_archive 
    ok
    push mini_archive 
    Counting objects: 7, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (5/5), done.
    Writing objects: 100% (5/5), 513 bytes | 0 bytes/s, done.
    Total 5 (delta 1), reused 0 (delta 0)
    remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
    To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
     ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
    error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
    failed
    git-annex: sync: 1 failed

From this state, the only way to resolve things is to launch the web app. It
tells me "synced with mini_archive" (and it starts uploading the new file). Then
on the server there is something to merge. (I haven't waited for the file to
finish uploading in this case.)

    schmitta@mini ~/a/archive> git annex merge
    merge git-annex (merging refs/synced/1cdfb490-0660-41fb-b7ce-74b89abb9aac/git-annex into git-annex...)
    ok
    schmitta@mini ~/a/archive> git annex sync
    commit
    ok

and I can then sync on the local repo:

    schmitta@top ~/D/annex (master) [1]> git annex sync
    commit
    ok
    pull mini_archive 
    From ssh://git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive
       8f39d4c..cb7f6c3  git-annex  -> mini_archive/git-annex
    ok

Note that I need to do the remote merge for things to work. After the file has
finished uploading, I get back in a conflict:

    schmitta@top ~/D/annex (master)> git annex sync
    commit
    ok
    pull mini_archive 
    ok
    push mini_archive 
    Total 0 (delta 0), reused 0 (delta 0)
    remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
    To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
     ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
    error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
    failed
    git-annex: sync: 1 failed

If I disable and re-enable the sync on the server (forcing a sync), I still have
a conflict locally:

    schmitta@top ~/D/annex (master) [1]> git annex sync
    commit
    ok
    pull mini_archive 
    ok
    push mini_archive 
    Total 0 (delta 0), reused 0 (delta 0)
    remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
    To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
     ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
    error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
    failed
    git-annex: sync: 1 failed

It only get solved by doing a merge on the server:

    schmitta@mini ~/a/archive> git annex merge
    merge git-annex (merging refs/synced/1cdfb490-0660-41fb-b7ce-74b89abb9aac/git-annex into git-annex...)
    (Recording state in git...)
    ok

    schmitta@top ~/D/annex (master) [1]> git annex sync
    commit
    ok
    pull mini_archive 
    remote: Counting objects: 13, done.
    remote: Compressing objects: 100% (5/5), done.
    remote: Total 5 (delta 3), reused 0 (delta 0)
    Unpacking objects: 100% (5/5), done.
    From ssh://git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive
       cb7f6c3..d177e1a  git-annex  -> mini_archive/git-annex
    ok
    (merging mini_archive/git-annex into git-annex...)


### What version of git-annex are you using? On what operating system?

Current version available on cabal:

    schmitta@top ~/D/annex (master)> git annex version
    git-annex version: 4.20131002
    build flags: Assistant Webapp Pairing Testsuite S3 WebDAV FsEvents XMPP DNS Feeds Quvi
    key/value backends: SHA256E SHA1E SHA512E SHA224E SHA384E SKEIN256E SKEIN512E SHA256 SHA1 SHA512 SHA224 SHA384 SKEIN256 SKEIN512 WORM URL
    remote types: git gcrypt S3 bup directory rsync web webdav glacier hook
    local repository version: 3
    default repository version: 3
    supported repository versions: 3 4
    upgrade supported from repository versions: 0 1 2

    schmitta@mini ~/a/archive> git annex version
    git-annex version: 4.20131002
    build flags: Assistant Webapp Pairing Testsuite S3 WebDAV FsEvents XMPP DNS Feeds Quvi
    key/value backends: SHA256E SHA1E SHA512E SHA224E SHA384E SKEIN256E SKEIN512E SHA256 SHA1 SHA512 SHA224 SHA384 SKEIN256 SKEIN512 WORM URL
    remote types: git gcrypt S3 bup directory rsync web webdav glacier hook
    local repository version: 3
    default repository version: 3
    supported repository versions: 3 4
    upgrade supported from repository versions: 0 1 2


### Please provide any additional information below.

Here is daemon.log. It mentions another repo which is an external
hard drive not plugged it at the moment. I'm skipping the file transmission
(...).

[[!format sh """
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log

[2013-10-23 14:02:05 CEST] main: starting assistant version 4.20131002
[2013-10-23 14:02:05 CEST] TransferScanner: Syncing with hole, mini_archive 
Already up-to-date.
fatal: '/Volumes/hole/annex/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

(scanning...) [2013-10-23 14:02:06 CEST] Watcher: Performing startup scan
Already up-to-date.
Already up-to-date.
fatal: '/Volumes/hole/annex/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
fatal: '/Volumes/hole/annex/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: '/Volumes/hole/annex/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
fatal: '/Volumes/hole/annex/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[2013-10-23 14:02:10 CEST] Committer: Committing changes to git
[2013-10-23 14:02:10 CEST] Pusher: Syncing with mini_archive 


(Recording state in git...)
(started...) To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
   8f39d4c..cb7f6c3  git-annex -> refs/synced/1cdfb490-0660-41fb-b7ce-74b89abb9aac/git-annex
   a5b002b..dde2626  master -> refs/synced/1cdfb490-0660-41fb-b7ce-74b89abb9aac/master
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
Everything up-to-date
(gpg) 


SHA256E-s608232213--d4d6e02e651b1d265ff1c041ee8e8c23db9d880140816d62b8cc82cee4db3a54.mp4

...

sent 608306626 bytes  received 42 bytes  5133389.60 bytes/sec
total size is 608232213  speedup is 1.00
[2013-10-23 14:04:13 CEST] Transferrer: Uploaded Icy and F..cDl4Y.mp4
[2013-10-23 14:04:13 CEST] Pusher: Syncing with mini_archive 
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
   cb7f6c3..927cc1c  git-annex -> refs/synced/1cdfb490-0660-41fb-b7ce-74b89abb9aac/git-annex
[2013-10-23 14:05:35 CEST] main: Syncing with mini_archive 
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
remote: error: denying non-fast-forward refs/heads/synced/git-annex (you should pull first)
To ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/
 ! [remote rejected] git-annex -> synced/git-annex (non-fast-forward)
error: failed to push some refs to 'ssh://schmitta@git-annex-**.**.**.**-schmitta_annex.2Farchive/~/annex/archive/'
Everything up-to-date


# End of transcript or log.
"""]]

> So, receive.denyNonFastforwards was the problem. It turns out that
> `git init --bare --shared` sets that by default, and the webapp
> uses that to create repositories on ssh server. I have made the webapp
> unset receive.denyNonFastforwards when setting up such a repository.
> 
> Also added something to the assistant release notes about this
> to handle existing repositories. [[done]] --[[Joey]]