Uwe Andersen
Uwe Andersen

Reputation: 337

How to create new git repository with SourceTree?

Here is what I did so far (in SourceTree):

  1. Choose "Create New Repository"
  2. choose a destination path ("hallo")
  3. create a file in the "hallo" directory
  4. commit that file (which creates a local master branch)
  5. create a new remote (ssh://[email protected]:22/srv/git/hallo)
  6. push to remote branch

Now I get an error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master

Pushing to ssh://[email protected]:22/srv/git/hallo

fatal: '/srv/git/hallo' does not appear to be a git repository
fatal: Could not read from remote repository.

I am working with a a dozen of other repositiories without any difficulties on that server. So it can't be an access or ssh problem. I also double checked the ip address of the server.

If I start the terminal and write "git remote -v" I get:

origin ssh://[email protected]:22/srv/git/hallo (fetch)
origin ssh://[email protected]:22/srv/git/hallo (push)

If I try to push ("git push origin master") I get:

fatal: '/srv/git/hallo' 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.

I have no clue what I'm missing. Can you help?

Upvotes: 1

Views: 5982

Answers (1)

VonC
VonC

Reputation: 1330072

No, I didn't. Do I have to? I thought pushing a commit will do this for me.

Yes you should create a remote repo first.

Connect to ssh://[email protected]:22, and create a bare repo:

cd /srv/git/
git init --bare hallo

Upvotes: 1

Related Questions