Browsing all articles in Version Control

“warning: updating the current branch” when pushing to a git repository

Posted Posted by Wes in Version Control     Comments No comments
Mar
8

I pushed some changes after updating git on my server to git 1.6+ and now I get this:

$ git push origin master
...
warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning:
warning: You can set 'receive.denyCurrentBranch' configuration variable to
warning: 'refuse' in the remote repository to forbid pushing into its
warning: current branch.
warning: To allow pushing into the current branch, you can set it to 'ignore';
warning: but this is not recommended unless you arranged to update its work
warning: tree to match what you pushed in some other way.
warning:
warning: To squelch this message, you can set it to 'warn'.
warning:
warning: Note that the default will change in a future version of git
warning: to refuse updating the current branch unless you have the
warning: configuration variable set to either 'ignore' or 'warn'.

Woah! After some research, this is because I didn’t set up my remote folder as “bare”. A non-bare repository has a working copy attached to it, and this warning is telling you that said working copy exists and is currently checked out to the branch you’re trying to push to.

This is bad, because if you were pushing to a co-worker’s machine, then when they go to commit or run a diff, things will go awry. In this case, I just didn’t set up the repository correctly (it was the first one I’d done!) so I wasn’t in danger of losing anything.

The fix is to use --bare:
git init --bare or git clone --bare

Capistrano deploy error "fatal: unable to create '.git/index.lock': File exists"

Posted Posted by Wes in Ruby on Rails, Version Control     Comments No comments
Oct
21

This isn’t specific to capistrano, necessarily, but I ran into it deploying.

fatal: unable to create '.git/index.lock': File exists
read more

git: You asked me to pull without telling me which branch …

Posted Posted by Wes in Version Control     Comments No comments
Jul
1

Received this error when trying to pull from a remote origin:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either.

read more

git: failed to push some refs

Posted Posted by Wes in Programming, Version Control     Comments No comments
Jun
26

I’m really digging git, but its error messages are less than helpful at times.

git push origin master
error: failed to push some refs to origin

Most likely, there are changes in the remote repo that you need to pull first:

git pull origin master

Resolve any conflicts, then you can push to the remote git repo.

I’m not sure why “failed to push some refs” couldn’t include “(do you need to pull?)”

Visualizing git history

Posted Posted by Wes in Version Control     Comments No comments
Mar
10

I’ve been using git for version control on a new project. Instead of needing a connection to the server (as CVS and SVN do), changes are stored locally.

Every once in a while, I want to poke back the history. git ships with a graphical repository viewer, but I like gitx better.

git makes branching off to try something super easy, which is quickly becoming one of my favorite features. I can create a branch quickly, try something out, switch away and come back later if I want.

Using gitx to view my repository history, I can quickly find where branches diverged and it’s just kinda neat to look at.

blog Categories

about databasically

We live and work in Kansas City, USA.

We're passionate about helping small businesses succeed and want to help you use technology to get more done.

From server, desktop, network management to programming custom web applications in Ruby on Rails, we're here to lend a hand.

Contact us if you have any questions!