Re: Need some remedial git help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/23/2015 05:41 PM, Sandra McCann wrote:

Hi folks -


I’m trying to follow these directions so that I have a personal branch to work on the virt getting started guide, that is backed up to fedorapeople.  Somehow I’m failing but I don’t know where.


This is what I tried :


  1. git clone --bare https://git.fedorahosted.org/cgit/docs/virtualization-getting-started-guide.git/ virtualization-getting-started-guide.git

  2. cd virtualization-getting-started-guide.git

  3. git branch smccann_virtmanager

  4. git checkout smccann_virtmanager

This gives me the following error: fatal: this operation must be run in a work tree.


Looking that up, it seems I shouldn’t have cloned as --bare.


So I try again….w/o the bare…


  1. git clone  https://git.fedorahosted.org/cgit/docs/virtualization-getting-started-guide.git/ virtualization-getting-started-guide.git

  2. cd virtualization-getting-started-guide.git

  3. git branch smccann_virtmanager

  4. git checkout smccann_virtmanager


this looks better…

  1. touch git-daemon-export-ok (so it’s visible on cgit)


 scp it up to fedorapeople:

  1. scp -r virtualization-getting-started-guide.git/ mccann2@xxxxxxxxxxxxxxxx:public_git/virtualization-getting-started-guide.git


So far so good. Let’s make a minor edit, add and commit…

  1. (edit Book_Info.xml and build to ensure it works)

  2. git add en-US/Book_Info.xml

  3. git commit -m ‘first commit. Fix Book_Info.xml so it will build’


Now try to push that to fedorapeople:

  1. git remote add fedorapeople mccann2@xxxxxxxxxxxxxxxx:public_git/virtualization-getting-started-guide.git

  2. git push --mirror fedorapeople

This gets me the following batch of errors:


git push --mirror fedorapeople

Counting objects: 4, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (4/4), done.

Writing objects: 100% (4/4), 394 bytes | 0 bytes/s, done.

Total 4 (delta 3), reused 0 (delta 0)

remote: error: refusing to update checked out branch: refs/heads/smccann_virtmanager

remote: error: By default, updating the current branch in a non-bare repository

remote: error: is denied, because it will make the index and work tree inconsistent

remote: error: with what you pushed, and will require 'git reset --hard' to match

remote: error: the work tree to HEAD.

remote: error:

remote: error: You can set 'receive.denyCurrentBranch' configuration variable t

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int

remote: error: its current branch; however, this is not recommended unless you

remote: error: arranged to update its work tree to match what you pushed in som

remote: error: other way.

remote: error:

remote: error: To squelch this message and still keep the default behaviour, se

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

To mccann2@xxxxxxxxxxxxxxxx:public_git/virtualization-getting-started-guide.git

! [remote rejected] smccann_virtmanager -> smccann_virtmanager (branch is currently checked out)

error: failed to push some refs to 'mccann2@xxxxxxxxxxxxxxxx:public_git/virtualization-getting-started-guide.git'


So now I’m lost in some weird catch-22 where --bare is needed for one set of commands, but won’t work for the other.  I’m guessing I’m missing something obvious here… Any clues what that is?

Thanks,
Sandra


With git, like many things, you can get to the same place a few different ways.  If you create the bare repo on fedorapeople, you don't need to scp your local repo there;  bare repos don't have a working tree, it's essentially just the .git/ portion of the folder.  When you scp over your non-bare repo, it *does* have a checked out branch, so you get complaints.  

Start over with creating the fedorapeople repo, but when you create it, do simply `git init --bare` without the extra repo arguments.  Skip the scp. Everything will get filled in when you push.  The fedorapeople repo is the only bare one; once it is created, we don't do anything with it directly.  It only serves as a remote.

After the repo is created, the steps for creating a branch, checking out the branch, committing, adding a remote - you've done all that right, just make sure they're all on your local repo.  To save yourself some typing, when you have your branch checked out locally and the remote added, you can do `git branch --set-upstream-to=fedorapeople` and you won't have to specify the remote next time.
-- 
-- Pete Travis
 - Fedora Docs Project Leader
 - 'randomuser' on freenode
 - immanetize@xxxxxxxxxxxxxxxxx
-- 
docs mailing list
docs@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe:
https://admin.fedoraproject.org/mailman/listinfo/docs

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Red Hat 9]     [Yosemite News]     [KDE Users]

  Powered by Linux