I have created a Git repository locally and committed a file to it:
$ mkdir blarg && cd blarg
$ git init
Initialized empty Git repository in /home/myuser/tests/blarg/.git/
$ echo a line > test.txt
$ git add .
$ git commit -m "initial commit"
[master (root-commit) f47ef6d] initial commit
1 file changed, 1 insertion(+)
create mode 100644 test.txt
I want my server to host this repository, so I have created a bare empty repository there and configured access to it (this part works fine). I can set this repository as a remote in my local repo and push to it:
$ git remote add --track master origin https://git.example.net/repos/blarg.git
$ git remote -v
origin https://git.example.net/repos/blarg.git (fetch)
origin https://git.example.net/repos/blarg.git (push)
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 216 bytes | 216.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git.example.net/repos/blarg.git
* [new branch] master -> master
$ git pull
Already up to date.
$ git status
On branch master
nothing to commit, working tree clean
$ git log --oneline
f47ef6d (HEAD -> master, origin/master) initial commit
This all seems to work as intended. However, after cloning this repository from the server into a new directory, the git status
message is slightly different in the cloned repo, and git log
also shows one more ref than in the original repo:
$ cd ..
$ git clone https://git.example.net/repos/blarg.git blarg2
Cloning into 'blarg2'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done
$ cd blarg2
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ git log --oneline
f47ef6d (HEAD -> master, origin/master, origin/HEAD) initial commit
Note that git only prints "Your branch is up to date with 'origin/master'." in the cloned repository, and that the log there mentions origin/HEAD
.
What's going on, and how can I adjust my original repo to behave like the cloned one?