lucas@calliope MINGW32 /e/testenv $ git clone https://www.wingedleopard.net/git/websites/th … forum/.git Cloning into 'thinktankforum'... remote: Counting objects: 1377, done. remote: Compressing objects: 100% (421/421), done. remote: Total 1377 (delta 975), reused 1344 (delta 954) Receiving objects: 100% (1377/1377), 351.44 KiB | 459.00 KiB/s, done. Resolving deltas: 100% (975/975), done. Checking connectivity... done. lucas@calliope MINGW32 /e/testenv $ cd thinktankforum/ lucas@calliope MINGW32 /e/testenv/thinktankforum (master) $ vim register.php lucas@calliope MINGW32 /e/testenv/thinktankforum (master) $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: register.php no changes added to commit (use "git add" and/or "git commit -a") lucas@calliope MINGW32 /e/testenv/thinktankforum (master) $ git add . lucas@calliope MINGW32 /e/testenv/thinktankforum (master) $ git commit -m "WTF GIT" [master 011af82] WTF GIT 1 file changed, 1 insertion(+) lucas@calliope MINGW32 /e/testenv/thinktankforum (master) $ git push warning: push.default is unset; its implicit value has changed in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the traditional behavior, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name. Since Git 2.0, Git defaults to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch. See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 306 bytes | 0 bytes/s, done. Total 3 (delta 2), 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 t remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int 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 som remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, se remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. To https://www.wingedleopard.net/git/websites/th … forum/.git ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to 'https://www.wingedleopard.net/git/websites/thinktankforum/.git'
~ $ mkdir server ~ $ cd server ~/server $ git init --bare Initialized empty Git repository in /home/mastensg/server/ ~/server $ cd .. ~ $ git clone server laptop Cloning into 'laptop'... warning: You appear to have cloned an empty repository. done. ~ $ cd laptop ~/laptop $ echo a > file ~/laptop $ git add file ~/laptop $ git commit -m "add file" [master (root-commit) f47d34b] add file 1 file changed, 1 insertion(+) create mode 100644 file ~/laptop $ git push Counting objects: 3, done. Writing objects: 100% (3/3), 215 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To /home/mastensg/server * [new branch] master -> master ~/laptop $ cd ../server ~/server $ git log --oneline f47d34b (HEAD, master) add file ~/server $
git clone --bare ...
git config --global push.default matching
websites/thinktankforum/.git
<VirtualHost 10.0.0.1:443> ServerName www.mydomain.com RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC] RewriteRule ^/?(.*) https://www.mydomain.com/ $1 [L,R=301] SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /home/user/web/ssl/mydomain-com.crt SSLCertificateKeyFile /home/user/web/ssl/mydomain-com.key SSLCACertificateFile /home/user/web/ssl/rapidssl.crt DocumentRoot /home/user/web/mydomain-com <Directory /home/user/web/mydomain-com> Options All AllowOverride All Require all granted </Directory> CustomLog /home/user/web/log/access_mydomain-com.log combined ErrorLog /home/user/web/log/error_mydomain-com.log ScriptAliasMatch \ "(?x)^/git/(.*/(HEAD | \ info/refs | \ objects/(info/[^/]+ | \ [0-9a-f]{2}/[0-9a-f]{38} | \ pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ git-(upload|receive)-pack))$" \ /usr/lib/git-core/git-http-backend/$1 <Directory /usr/lib/git-core> SetEnv GIT_PROJECT_ROOT /home/user/git SetEnv GIT_HTTP_EXPORT_ALL Options +ExecCGI SSLRequireSSL AuthType Basic AuthName "private" AuthUserFile /home/user/web/passwd Require valid-user </Directory> Alias /git/ /usr/share/gitweb/ <Directory /usr/share/gitweb> SetEnv GITWEB_CONFIG /home/user/git/gitweb.conf SetEnv GIT_PROJECT_ROOT /home/user/git AddHandler cgi-script .cgi DirectoryIndex gitweb.cgi Options +ExecCGI SSLRequireSSL AuthType Basic AuthName "private" AuthUserFile /home/user/web/passwd Require valid-user </Directory> WSGIScriptAlias /hg /home/user/hg/hgweb.wsgi <Directory /home/user/hg> AddHandler wsgi-script .wsgi Options +ExecCGI SSLRequireSSL AuthType Basic AuthName "private" AuthUserFile /home/user/web/passwd Require valid-user </Directory> Alias /pma /home/user/web/pma <Directory /home/user/web/pma> SSLRequireSSL Require all granted </Directory> <Location /svn> DAV svn SVNParentPath /home/user/svn SVNListParentPath On SSLRequireSSL AuthType Basic AuthName "private" AuthUserFile /home/user/web/passwd Require valid-user </Location> </VirtualHost>
$ sudo pkg install hs-git-annex Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. The following 211 package(s) will be affected (of 0 checked): New packages to be INSTALLED: ... The process will require 2 GiB more space. 193 MiB to be downloaded. Proceed with this action? [y/N]:
lucas@calliope MINGW32 /e/demo $ git init Initialized empty Git repository in E:/demo/.git/ lucas@calliope MINGW32 /e/demo (master) $ git annex init init Detected a filesystem without fifo support. Disabling ssh connection caching. Detected a crippled filesystem. Enabling direct mode. ok (recording state in git...) lucas@calliope MINGW32 /e/demo (annex/direct/master) $ git annex add . add tails-i386-2.12.iso ok (recording state in git...) lucas@calliope MINGW32 /e/demo (annex/direct/master) $ git commit -a -m addedstuff fatal: This operation must be run in a work tree
lucas@calliope MINGW32 /e $ mkdir demo2 lucas@calliope MINGW32 /e $ cd demo2 lucas@calliope MINGW32 /e/demo2 $ git init Initialized empty Git repository in E:/demo2/.git/ lucas@calliope MINGW32 /e/demo2 (master) $ git status On branch master Initial commit nothing to commit (create/copy files and use "git add" to track) lucas@calliope MINGW32 /e/demo2 (master) $ git annex init init Detected a filesystem without fifo support. Disabling ssh connection caching. Detected a crippled filesystem. Enabling direct mode. ok (recording state in git...) lucas@calliope MINGW32 /e/demo2 (annex/direct/master) $ git status fatal: This operation must be run in a work tree lucas@calliope MINGW32 /e/demo2 (annex/direct/master) $
lucas@calliope MINGW32 /e $ mkdir demo3 lucas@calliope MINGW32 /e $ cd demo3 lucas@calliope MINGW32 /e/demo3 $ git init Initialized empty Git repository in E:/demo3/.git/ lucas@calliope MINGW32 /e/demo3 (master) $ echo hello > myfile lucas@calliope MINGW32 /e/demo3 (master) $ git add myfile warning: LF will be replaced by CRLF in myfile. The file will have its original line endings in your working directory. lucas@calliope MINGW32 /e/demo3 (master) $ git commit -m "a new hello." [master (root-commit) 714edff] a new hello. warning: LF will be replaced by CRLF in myfile. The file will have its original line endings in your working directory. 1 file changed, 1 insertion(+) create mode 100644 myfile lucas@calliope MINGW32 /e/demo3 (master) $ git annex init init Detected a filesystem without fifo support. Disabling ssh connection caching. Detected a crippled filesystem. Enabling direct mode. ok (recording state in git...) lucas@calliope MINGW32 /e/demo3 (annex/direct/master) $ echo "byebye" > myfile2 lucas@calliope MINGW32 /e/demo3 (annex/direct/master) $ git add myfile2 fatal: This operation must be run in a work tree lucas@calliope MINGW32 /e/demo3 (annex/direct/master) $
Windows always uses direct mode.
what doesn't work in direct mode
A very few git-annex commands don't work in direct mode, and will refuse to do anything. For example, git annex unlock doesn't make sense in direct mode.
As for git commands, direct mode prevents using any git command that would modify or access the work tree. So you cannot git commit or git pull (use git annex sync for both instead), or run git status (use git annex status instead). These git commands will complain "fatal: This operation must be run in a work tree".
The reason for this is that git doesn't understand how git-annex uses the work tree in direct mode. Where git expects the symlinks that get checked into git to be checked out in the work tree, direct mode instead replaces them with the actual content of files, as managed by git-annex.
There are still lots of git commands you can use in direct mode. For example, you can run git log on files, run git push, git fetch, git config, git remote add etc.