StudioTime
StudioTime

Reputation: 23969

Setting up remote git repo for pushes

I have the following remote directory:

/home/darren77

I use git init --bare to set up the directory as a repo

which adds .git directory

Then on local pc I have directory that is my workspace

c:/testAccount/

I then try to clone the remote repo to set up to push:

$ git clone ssh://[email protected]/home/darren77.git

But I get the following:

stdin: is not a tty
fatal: '/home/darren77.git' does not appear to be a git repository
fatal: Could not read from the remote repository

Please make sure you have the correct access rights and the repository exists.

What am I doing wrong? There's so much talk about this but no one place that actually details it in absolute basic format for users new to git, not that I can find anyway.

Upvotes: 1

Views: 64

Answers (2)

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72745

You should probably not make a home directory a repository. Make a subdirectory called repos or something and then a bare repository inside that with the name of your project and a .git suffix. The path would be /home/darren77/repos/project0.git. Inside this directory would be the contents of the .git directory (i.e. a bare repository).

git init --bare shouldn't create a .git directory. If it is, something is wrong.

After verifying these, try ssh [email protected] to see if you can connect to the server properly. If yes, consider using this syntax (it's what I use). git clone [email protected]:/home/darren77/repos/project0.git

Upvotes: 0

VonC
VonC

Reputation: 1323553

Try:

git clone ssh://[email protected]/home/darren77/.git

The git init --bare could have created a .git folder inside /home/darren77

A more appropriate name for that repo would be:

cd /home/darren77
git init --bare myrepo

That will create a myrepo.git/ folder (a folder ending with .git)

Then you would clone it with:

git clone ssh://[email protected]/home/darren77/myrepo.git

Upvotes: 1

Related Questions