Re: Need some remedial git help

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

 





On 03/23/2015 10:35 PM, Glen Rundblom wrote:


On 03/23/2015 06:22 PM, Pete Travis wrote:
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


Hi Pete, Sandra, and everyone.
That is what I did with my personal repo, I cloned the getting started guide locally, made a bare repo with the same name on my fedora people account, and then "colored it in" with my first remote push.




Forgive me Sandra, that was not very helpful. Here is what I did in detail when I setup my fedorapeople account. I commented it and hopefully it will be of more use then my last comment.
(its late, and I am tired but my brain wont let me sleep)

I sshed into the fedorapeople server:
and then.....
# Made my public Git directory   
7  mkdir ~/public_git; /sbin/restorecon -Rv ~/public_git
# Tried to remember where I was
    8  pwd
# made my initial Public html direcotry
    9  mkdir public_html
# make sure I did what I was thinking I was doing
   10  ls
   11  cd public_
   12  cd public_html/
   13  ls
   14  nano index.html
# made sure I was editing the web directory I thought I was
   16  exit
#not sure what that exit was all about
   17  ls
   18  cd public_git/
   19  ls
# Here is where I made my copy of the virtualization getting started guide. I did a mkdir and then pasted the last of the filename "virtualization-getting-started-guide.git"
   20  mkdir virtualization-getting-started-guide.git
# Enter the directory I just made
   21  cd virtualization-getting-started-guide.git/
# Initialize the Repo
   22  git init --bare
   23  touch git-daemon-export-ok

After that, I then pushed my local cloned copy of the virtualization guide up to my fedora people repo. Using the instructions from http://fedoraproject.org/wiki/Infrastructure/fedorapeople.org#Create_a_.7E.2Fpublic_git_directory_on_fedorapeople.org

I had to do the git remote add, and then push it...

$git remote add fedorapeople grundblom@xxxxxxxxxxxxxxxx:public_git/virtualization-getting-started-guide.git
$git push fedorapeople

I hope that helps!

-- 
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