On the first machine, you created a non-bare repository, or a repository that has a working copy. Pushing to a non-bare repo can get a little exciting, so make sure that’s actually what you want.

On the second machine, you created a new repository in the current directory (git init), then cloned gitrepo into a sub-directory as a second repo. Again, that’s fine, just make sure it’s what you wanted.

Here’s how it would work with a bare repo on the first machine and one repo on the second:

First machine:

  1. git init --bare gitrepo.git

Second machine:

  1. git clone user@server:~/gitrepo.git
  2. cd gitrepo
  3. touch test
  4. git add test
  5. git commit -a
  6. # '-u' tells git to track the remote master branch with your local master branch
  7. git push -u origin master

分类: web

标签:   github