Pushing files on one git-branch

I have a website on a server and I want to begin sharing my work and so I am working with git. I am very new to it.

So on the remote server, I made a “git init” and a git commit to move all the work on the .git directory (always on the remote server).

  • git filter branch fatal revision
  • Can't exclude user interface state from commit in xcode
  • git status on branch don't show difference between local repo and remote repo
  • How to squash a lot of commits automatically?
  • git push non for all the commits
  • git diff showing deletes as new changes
  • Then I made a git clone (with an ssh connection) on my local server. And then I changed some files and committed it (worked fine) and then pushed it, but here is the error message :

    remote: error: refusing to update checked out branch: refs/heads/master
    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 to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    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 some
    remote: error: other way.
    remote: error: 
    remote: error: To squelch this message and still keep the default behaviour, set
    remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
    To ssh://sameditr@ftp.sameditresfroid.fr/homez.501/sameditr/www/.git
     ! [remote rejected] master -> master (branch is currently checked out)
    error: failed to push some refs to 'ssh:...'
    

    Does anybody has an idea ?

    Best,
    Newben

  • What should 'git log ^X' show?
  • How do I import a new release of a project into my git repository?
  • How do I enable msysgit colored output when using console2
  • Detach (move) multiple subdirectories into separate Git repository
  • Find which revision an export is from
  • Heroku deploy a sub directory?
  • 2 Solutions collect form web for “Pushing files on one git-branch”

    If you meant to create central repository on remote server, you should create bare repository:

    git init --bare
    

    You can configure current non-bare repository to accept updates (the error message is even telling you how), but much simpler way is to delete current repo on a remote server and create the new, bare one.

    Here’s a link to detailed explanation of difference between bare and non-bare repos.

    I usually do the following:

    on server, inside webapp directory

    $ git init
    $ git add *
    $ git commit -a
    

    to have at lease an Initial Commit

    on dev computer, you may do:

    $ git init
    $ git remote add origin git+ssh://server/var/www/.git/
    $ git branch --set-upstream master origin/master
    $ git pull
    

    edit files on dev

    $ git push
    

    Hope this helps!

    Git Baby is a git and github fan, let's start git clone.