简体   繁体   中英

Git annex test add file, sync

I have created a git annex repo, added data. I then went to check it out in another location in the following way (my goal is to checkout origin, add a test file, push it back to origin).

git clone ../test_repo/
cd test_repo/
git status
git annex init DEV touch test.txt
vi test.txt
git annex merge
git annex add test.txt
git commit -am "test"
git push origin master git-annex

However I am getting the following error

Counting objects: 3, done.
Delta compression using up to 48 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 364 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0)
remote: error: refusing to update checked out branch:
refs/heads/master
remote: error: By default, updating the current
branch in a non-bare repository
remote: error: is denied, because it
will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD. remote: error: remote: error: You can set 'receive.denyCurrentBranch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way. remote: error:
remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. To /test_repo/ ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/test_repo/'

What am I missing?

I did not recognise some of the commands that you used to establish your second git annex repository, but I can tell you how I did the same, and had it working.

  git clone ../test_repo/
  cd test_repo/
  git annex init "My new annex copy"
  git annex sync

Since it already has the original repository as the remote origin , it should be able to sync the metadata.

From then on you can add files and sync them to the other repository, eg

vi test.txt
git annex add test.txt
git commit -m "test"
git annex sync --content

I like to do a commit after calling annex add and before calling annex sync, because annex sync does some automatic commits.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM