Search notes:

git clone - Effects on the .git/config file

The purpose of the following snippets is to demonstrate the effect of git clone on the .git/config file.

Create an empty repository

First, we need to create a repository (git init etc):
git init --quiet repo
cd repo
Github repository about-git, path: /commands/clone/config/init.ps1

Add some content to the repo

A file is added and committed:
'hello world' > file.txt
git add file.txt
git commit . --quiet -m "+ file.txt"
Github repository about-git, path: /commands/clone/config/add-file.ps1

Cloning the repository:

The repository is cloned:
cd ..
git clone --quiet repo repo.clone
cd repo.clone
Github repository about-git, path: /commands/clone/config/clone.ps1

Content of .git/config

cat .git/config
Github repository about-git, path: /commands/clone/config/cat-config.ps1
The content of .git/config is:
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = C:/…/git/commands/clone/config/repo
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

See also

Using a Personal Access Token in the URL when cloning a repository.
git clone

Index