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

Re: Commit changes to remote repository

From
Carlos Martín Nieto <cmn@elego.de>
Date
Jan 14, 2012, 11:31 UTC
Message-ID
<20120114113141.GG2850@centaur.lab.cmartin.tk>
In-Reply-To
<1326486589088-7185551.post@n2.nabble.com>
On Fri, Jan 13, 2012 at 12:29:49PM -0800, ruperty wrote:
Show 28 quoted lines
> Being new to git I am probably not doing things correctly so pointers in the
> right direction would be useful.
> 
> What I want to do make changes on my laptop and commit them to a remote
> repository. Here is what I have done,
> 
> 1. Created a repository on my remote linux host, in a folder of cource code,
> by,
> 
>    git init
>    git add *
>    git commit
> 
> 2. On my laptop I did a git clone pointing by ssh to the remote repo which
> downloaded all the files to my local system.
> 
> 3. I changed a file locally and did a commit.
> 
> 4. I then wanted to update the remote repo with my change, which I did with
> a git push, but that didn't work, getting this error,
> 
>     remote: error: refusing to update checked out branch:
> refs/heads/master
>     remote: error: By default, updating the current branch in a non-bare
> repository.......
> 
> 
> What am I doing wrong?

You're trying to push to a non-bare repository and change the currently active branch, which can cause problems, so git isn't letting you. There's an explanation of bare and non-bare at http://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that you should init the repo you want to use as the central point with --bare and do modifications locally and then push there.

   cmn
Previous: rupertyNext: Matthieu Moy
Message 2 of 4 in “Commit changes to remote repository”
  1. rupertyJan 13, 2012
  2. Carlos Martín NietoJan 14, 2012
  3. Matthieu MoyJan 14, 2012
  4. Junio C HamanoJan 17, 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.