Global init.templatedir setting ignored when cloning repositories
See original GitHub issueDescribe the bug
The templatedir configuration appears to be ignored by Desktop when cloning a repository.
Version & OS
Version 2.2.4 macOS 10.15.2 (19C57)
Steps to reproduce the behavior
- Create a directory with template hooks
mkdir -p /var/tmp/testtemplatedir/hooks
echo "#!/usr/bin/env bash" > /var/tmp/testtemplatedir/hooks/post-checkout
echo "echo hi" >> /var/tmp/testtemplatedir/hooks/post-checkout
chmod +x /var/tmp/testtemplatedir/hooks/post-checkout
- Configure template directory
git config --global init.templatedir /var/tmp/testtemplatedir/hooks/post-checkout
- Open Desktop and clone any repository (e.g., https://github.com/desktop/desktop.git)
- Examine the
.git/hooks
directory inside of the newly cloned repository
Expected behavior
The post-checkout hook should be present in the clone
Actual behavior
The repository only contains the default sample hooks and does not contain the post-checkout hook
Additional context
Cloning the same repo via the git CLI (version 2.24.1) properly utilizes the template dir.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Git doesn't clone content of template directory - Stack Overflow
I'm doing the git config init.templatedir on the server, because I thought the templatedir was cloned to the local .git directory..... I think...
Read more >git-init Documentation - Git
This command creates an empty Git repository - basically a .git directory with subdirectories for objects , refs/heads , refs/tags , and template...
Read more >Change git init default branch name - Super User
git config --global init.defaultBranch main. After setting this variable, running git init will produce a repository whose initial branch is ...
Read more >Upgrading from 2.xx to 3.xx - Git Template
It means each time you create a new repository, and each time you clone a repository, ... git config --global init.templatedir '~/.git_template/template'.
Read more >Setting up a Git Repository - Visual Studio for Mac
In this article. Creating a remote repo on GitHub; Clone an existing repository. Applies to: yes Visual Studio for Mac no Visual Studio....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Minimal log in case it helps
I was able to replicate this using Desktop v2.2.4 and git v2.25.0 on macOS 10.15.2. Here’s what I did:
git config --global init.templateDir
git init
.git/hooks
directory contained only the one filepost-checkout
with the contents expectedgit clone
.git/hooks
directory contained only the one filepost-checkout
with the contents expected. Additionally, I saw thehi
message at the end of the clone process.git/hooks
directory did not contain the expectedpost-checkout
file but did contain the standard git sample hooks.git/hooks
directory did not contain the expectedpost-checkout
file but did contain the standard git sample hooks