git/list[1] front-page[2] threads[3] people[4] search[5] about
 

clone bug

From
AKAlexey Kuznetsov <kuznetsov.alexey@gmail.com>
Date
Jan 12, 2012, 13:43 UTC
Message-ID
<CAO1Zr+pSLwRbsEZ_0LCeE2qLn+S=iMKVcMjqtYrmiBoQmjac_A@mail.gmail.com>
Hello!

Seems like I found a bug in the clone / push logic. I'm trying to clone remote branch master into local branch called common and unable to push back common to master. Git trying to push local master from different origin to common/master instead.

Here is a simple example:
# mkdir 123
# git init
# > 123
# git add .
# git commit -m "initial"
# git branch
axet-laptop:123 axet$ git branch
* master
# git remote add common https://github.com/axet/common-bin.git
# git fetch common
From https://github.com/axet/common-bin
 * [new branch]      master     -> common/master
?? already strange master (local) to the remote common/master

# axet-laptop:123 axet$ git checkout -b common common/master Branch common set up to track remote branch master from common. Switched to a new branch 'common'

# axet-laptop:123 axet$ git branch
* common
  master
axet-laptop:123 axet$

# cat .git/config [...]

[branch "common"]
	remote = common
	merge = refs/heads/master
?? correct
axet-laptop:123 axet$ git pull
Already up-to-date.
axet-laptop:123 axet$ git push
To https://github.com/axet/common-bin.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/axet/common-bin.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
axet-laptop:123 axet$
it tries to push local master to remote common/master which is not correct.
-- AK
Next: Thomas Rast
Message 1 of 3 in “clone bug”
  1. Alexey KuznetsovJan 12, 2012
  2. Thomas RastJan 12, 2012
  3. Andreas SchwabJan 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.