I'm new to git. I am struggling hard while looking at "Introduction to git" of "Dot Installation" and crawling.


Local: Mac OSX 1.13.6
Server: xrea plus

Conceived file structure

(Server side)

├── git
│ └── some.web.site
└── public_html
       └── some.web.site
              └── .git
/ path/to/MAMP
└── htdocs
       └── some.web.site
              └── .git
What i am doing

Make notes while watching the web and say this? I'm hitting the command without understanding half, but I get an error and it ends up unsuccessfully.
Although there was a time when I went well, I can't fix my symptoms after the error came out.

What i am doing specifically
  • First, make ainitial commitlocally.
    From here, it will besshwork on the server for a while.
$mkdir -p ~/git/some.web.site
$cd ~/git/some.web.site
$git init --bare

Edit the file

$vi ./hooks/post-receive
cd ~/public_html/some.web.site
git --git = dir = .git pull origin master: master
$cd hooks /
$chmod + x post-receive
$cd ~/public_html/some.wev.site
$git init
Initialized empty Git repository in /virtual/(username)/public_html/some.web.site/.git/
$git remote add origin ~/git/some.web.site

There is no error so far.
From here it is local.

$cd /path/to/MAMP/htdocs/some.web.site
$git clone ssh: // (username) @ (servername) .xrea.com: 22/virtual/(username) /git/some.web.site/ ... (* 1)
Cloning into 'some.web.site' ...
(username) @ (servername) .xrea.com's password:
warning: You appear to have cloned an empty repository.
$git push origin master: master ... (* 2)
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

(* 1) I understand somehow doing something strange.
I understand that there is an empty repository on the server and it is strange to try to pull it from there.
However, I don't know what to do.
I think that (* 2) doesn't work well if (* 1) solves it.

If only

(* 1) is wrong, please tell me how to fix it or whether it is wrong in the first place.

Update 2018.8.22 (wed) 19:53 I omitted

(* 1) and didgit remote, but the specification method is probably wrong and an error occurs.

$git remote add origin (username) @ (servername) .xrea.com: (username) /git/some.web.site ... (* 3)


$git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin master

As I said,

$git push --set-upstream origin master
error: src refspec master does not match any.
error: failed to push some refs to '(username) @ (servername) .xrea.com: (username) /git/some.web.site'

I get angry.

I'm imagining that

(* 3) is wrong, how can I fix it?

  • Answer # 1


    $git push -u origin master

    You will be asked for your remote server password,
    Since then

    $git push

    You can now go with just


  • Answer # 2

    * 1 work is unnecessary.

    The repository created on the server side is a remote repository set as origin and is empty.
    There is nothing to clone.

    As local work

    Set origin with git remote

    git push

    Isn't it working in the order of


    Maybe you are editing a .hook of the server side repository, so you might get an error in push ... (← out of knowledge)
    In that case, you should recreate the repository with --bare again, push it, and edit the .hook.