How do I push stuff to gitlab?

Eric S. Raymond esr at thyrsus.com
Wed Nov 18 23:37:28 UTC 2015


Hal Murray <hmurray at megapathdsl.net>:
> Somehow, I have to tell it who I am.
> 
> I think my ssh key is setup.  Is there a simple way to test that?
> 
> There is a name change involved.  I'm murray here but hal.murray there.
> 
> 
> .git/config says:
>         url = git at gitlab.com:NTPsec/ntpsec.git

That looks correct. It marches what I have.

> git push says:
> Counting objects: 4, done.
> Delta compression using up to 2 threads.
> Compressing objects: 100% (4/4), done.
> Writing objects: 100% (4/4), 403 bytes | 0 bytes/s, done.
> Total 4 (delta 3), reused 0 (delta 0)
> remote: error: cannot lock ref 'refs/heads/master': Unable to create 
> '/var/opt/gitlab/git-data/repositories/NTPsec/ntpsec.git/refs/heads/master.loc
> k': File exists.
> remote: 
> remote: If no other git process is currently running, this probably means a
> remote: git process crashed in this repository earlier. Make sure no other git
> remote: process is running and remove the file manually to continue.
> To git at gitlab.com:NTPsec/ntpsec.git
>  ! [remote rejected] master -> master (failed to update ref)
> error: failed to push some refs to 'git at gitlab.com:NTPsec/ntpsec.git'

That's disturbing.  It looks like a crash on GitLab.

I would do these steps:

1. Try the push again in case it's a transient error.  If that fails:

2. Rename the old repository directory.

3. Re-clone from gitlab, making a fresh repository,

3. Use git-format-patch in the old directory to extract your changes from
   the old repo into a sequence of patch files. So, if you want to move
   the last two commits the right thing to mutter is

   git format-patch HEAD~2..HEAD

4. The previous step will give you some files with names that begin with
   '0'. Move them to the new clone and use "git am" to apply them.

5. Push from there.

The point of this procedure is to avoid stumbling over any local debris
in your present repo clone that might be confusing git.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the devel mailing list