Can't Hard Link the gitconfig File
1 git config breaks hard links. Use a symbolic link instead. – William Pursell Aug 2 '12 at 22:22 ,Thanks to Dietrich Epp's answer and advice I have decided to approach this problem from a different angle by creating the repository at the root of my filesystem, and using .gitignore to track only the files I am interested in.,I am attempting to create a git repository to store all of my dotfiles and config files. My idea was to simply create hard links to all of the files I cared about and store those links in their own directory that I could turn into a repository.,In the meantime, have you considered doing the links in reverse? Create your repository full of config files, etc, and then in the place that you actually use your files, create a hard link to the 'real' file, which sits in the repository.
My .gitignore file now looks like this:
/* !/etc/ /etc/* # etc files !/etc/rc.conf !/etc/asound.conf !/etc/mercurial/ !/home/ !/home/matt/ /home/matt/* # Home files !/home/matt/.xinitrc !/home/matt/.gitconfig !/home/matt/.bashrc # Vim files !/home/matt/.vimrc !/home/matt/.vim/ .netrwhist
I changed the symbolic link to a hard link and somehow this works ok. I was able to verify this by opening the .gitconfig link within Windows; when using a symbolic link the file contained binary data however the hard-linked file contains the content as expected.,If you were modifying the file ( $ nano ~/.gitconfig ), you would put this into your file instead:,For those hitting into this issue (I believe it's due to crashing out git mid init?) in windows, if you have a recent backup of the config file from your git repo's .git/ folder you can fix it by replacing the existing with it (any ref's added since the copy will obviously need re-adding) - not at all ideal but better than loosing all the commits.,I have a habit of symlink-ing the config files in my home directory to a nested Git repository for maintaining the files across my multiple development environments. It turns out that Cygwin's implementation of a symbolic link doesn't make much sense to Git running under Windows.
If you were modifying the file (
$ nano ~/.gitconfig ), you would put this into your file instead:
[user] name = WilliamQLiu email = [email protected]
If false, symbolic links are checked out as small plain files that contain the link text. git-update-index and git-add will not change the recorded type to regular file. Useful on filesystems like FAT that do not support symbolic links.,If the pattern starts with ./, it is replaced with the directory containing the current config file., If the pattern starts with ./, it is replaced with the directory containing the current config file. ,A list of all available configuration variables can be obtained using the git help --config command.
git config [<file-option>] [--type=<type>] [--fixed-value] [--show-origin] [--show-scope] [-z|--null] name [value [value-pattern]] git config [<file-option>] [--type=<type>] --add name value git config [<file-option>] [--type=<type>] [--fixed-value] --replace-all name value [value-pattern] git config [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] [--fixed-value] --get name [value-pattern] git config [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] [--fixed-value] --get-all name [value-pattern] git config [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] [--fixed-value] [--name-only] --get-regexp name_regex [value-pattern] git config [<file-option>] [--type=<type>] [-z|--null] --get-urlmatch name URL git config [<file-option>] [--fixed-value] --unset name [value-pattern] git config [<file-option>] [--fixed-value] --unset-all name [value-pattern] git config [<file-option>] --rename-section old_name new_name git config [<file-option>] --remove-section name git config [<file-option>] [--show-origin] [--show-scope] [-z|--null] [--name-only] -l | --list git config [<file-option>] --get-color name [default] git config [<file-option>] --get-colorbool name [stdout-is-tty] git config [<file-option>] -e | --edit
Git list can help you find the gitconfig file.,If developers aren’t exactly sure where the various Git config files are supposed to be located, they can always run the following command in BASH:,How to find gitconfig.,Do you suspect that your attempt at microservices left you with distributed monolith application design? There are some telltale ...
/c/ where is gitconfig(examaple) $ git config--global--edit $ git config--system--edit $ git config--local--edit
If developers aren’t exactly sure where the various Git config files are supposed to be located, they can always run the following command in BASH:
sudo git - c core.editor = ls\ - al config--system--edit
You might have a hard time managing many cats, but when it comes to Git profiles there is something you can do.,We're all set! Now you will have three Git files in your home directory.,Create the global .gitconfig file in your home directory if it doesn't already exist. Then add all the profile directories as an entry like in the example below.,The idea is to segregate the repos on your machine into multiple directories by separating the profiles you want, and then define a .gitconfig file per profile.
[includeIf "gitdir:~/personal/"] path = ~/.gitconfig-personal [includeIf "gitdir:~/work/"] path = ~/.gitconfig-work
Retrieve the location (and name value pairs) of the system git configuration file:,Retrieve the unique locations of all git configuration files:,Retrieve the locations (and name value pairs) of all git configuration files:,The system configuration has also a fixed path on Windows, relative to the installation directory: etc\gitconfig
git config--list--show - origin
So I’ve finally found a solution that takes the best of both: put the repo in a subdirectory, and instead of symlinks, add a configuration option for “core.worktree” to be your home directory. Now when you’re in your home directory you’re not in a git repo (so the first problem is gone), and you don’t need to deal with fragile symlinks as in the second case. You still have the minor hassle of excluding paths that you don’t want versioned (eg, the “*” in “.git/info/exclude” trick), but that’s not new.
$ sudo ln - s~/git/config / .emacs~/.emacs
Get into a habit of editing configs, and adding then, committing changes. Push those changes back to your origin server periodically and pull/update when needed. I find that using Git is infectious and when I find a server not under Git config version control, I quickly go around adding its necessary configs into the repository. ,This article explains how I solved a couple of challenges of getting my initial environment and configs into Git—the first steps to using GitOps. ,Store production, test, and configuration in different branches and merge between them.,Easy to reuse configs - Just installed a new server and want to use 90% of a common apache configuration? Just clone the repo and copy the file.
My intention is to store all my configuration files for dnsmasq, httpd, and so on, all in Git. The configuration is sensitive, including usernames and passwords, so obviously a GitHub public repository isn’t the best idea. If you’re willing to pay for a private repository, go for it. I opted to create a repository on a dedicated server that I have on the public internet so that all other servers can connect to it.
$ cd / opt / $ sudo git init--bare ServerConfiguration.git
Other "undefined-undefined" queries related to "Can't Hard Link the gitconfig File"
- Manifest: Line: 1, column: 1, Syntax error. even after deleting the link to manifest in index.html
- Are CDN links needed if react and react dom packages are installed through npm?
- EACCES: permission denied, unlink
- React-router-dom Link changes url but doesn't update the view
- Router Link on Bootsrap React
- How to pass multiple state through link in ReactJS
- How do I link a data saved in cookie to a user?
- Using the Material UI Link component with the Next.JS Link Component
- Cant access property inside map function with spring transitions in ReactJs
- I have a typescript error when using jwt-refresh-link
- React-bootstrap set external link without active
- How to show the image links in an array of an object with map function in React?
- How to fix the error: Attempted import error: 'Navlink' is not exported from 'react-router-dom'
- Npm cant find package.json when installing react
- Missing isActive prop on NavLink of React Router v6
- React-app is (not) running on localhost:3000/*github link*
- I want to remove Underline in Bootstrap Link
- Why router links does not work in React-js
- How to use RouterLink with Microsoft FluentUI React Link component
- How to get correct links to source files in DevTools profiler in Create React App?
- Remove smooth scroll animation on changing page in NextJS with Link component
- Hard refresh using workbox when after build production
- React-Router External link
- Error: Invariant failed: You should not use <Link> outside a <Router> when I try to test my app using localhost
- Create firestore index link is not prompting in console
- Nginx / PHP FPM graceful stop (SIGQUIT): not so graceful
- Does linux kill background processes if we close the terminal from which it has started?
- Can You Switch PHP Sessions In a Session?
- How to add a string from variables to each line in a file in BASH
- Can I replace a Linux kernel function with a module?
- CURL error 60: SSL certificate in Laravel 5.4
- How to rename PHPSESSID?
- Append date to filename in linux
- Shell_exec() returning null on "ls"
- Delete digits after two decimal points, without rounding the value
- Close all File Handles when Calling posix_spawn
- What sort algorithm does PHP use?
- What's better at freeing memory with PHP: unset() or $var = null
- How to redirect https to http without any SSL Certificate
- How can I redirect with old input in Laravel?
- Process dies, if it is run via paramiko ssh session and with "&" in the end
- Display cards from a private Trello board without visitors needing a Trello account, or them needing to authorize via popup
- Is there a namespace aware alternative to PHP's class_exists()?
- How to rename a file name named "." [closed]
- How to pass a callback function pointer to epoll_event structure in C++