Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to clone git config from remote location?

Tags:

I have a bare repo on remote location with some configs I'd like to share with everyone who clones it. Is it possible? Every time I clone, it seems to revert everything in .git/config to defaults and just add information about remote repo.

like image 221
Ondrej Slinták Avatar asked Jul 01 '11 12:07

Ondrej Slinták


People also ask

How do I clone a remote git repository?

To Git clone a repository navigate to your preferred repository hosting service like GitHub, select the repository you want to clone, copy the repository URL via HTTPS or SSH, type git clone in the command line, paste the URL, and hit enter .

How do I clone a specific remote branch?

In order to clone a specific branch, you have to execute “git branch” with the “-b” and specify the branch you want to clone. $ git clone -b dev https://github.com/username/project.git Cloning into 'project'... remote: Enumerating objects: 813, done.

Does git clone connect to remote?

When you clone a repository with git clone , it automatically creates a remote connection called origin pointing back to the cloned repository. This is useful for developers creating a local copy of a central repository, since it provides an easy way to pull upstream changes or publish local commits.

Can git clones be tracked?

No, unless you clone the repo and add the local machine info in commit message, and then push to remote, so that the remote knows this local machine cloned this repo.


1 Answers

I confirm a local config (the one within .git/config) is never shared amongst repo
(for various security reasons, like, for instance,:

  • a git alias which would define some commands only valid in your particular environment
    (or git commands themselves: no, as Jan Hudec comments, and as detailed in the question "Is it possible to override git command by git alias?")
  • some github directive (github.token) supposed to be secret and incorrectly entered in the local config instead of the global one
  • personal config like user.name and user.email (which can be set on a local level if those differs from other repos): that wouldn't make sense to propagate my name and email when other clone my repo.
  • ... ).

The closest way to do that would be to version an actual file with the config in it, and invite users to copy it in their .git/config file

like image 106
VonC Avatar answered Nov 11 '22 04:11

VonC