Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT pushing a new project for the first time

I have a project on my local machine I've been working on alone, that I'd like to push to a remote server (running ubuntu & gitosis)

On the remote server I did

git init
Initialized empty Git repository in /home/stefan/.git/

Locally git status says

git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .DS_Store
#   .travis.yml
#   license.txt
#   nbproject/
#   bla/.DS_Store
#   bla/cache/
nothing added to commit but untracked files present (use "git add" to track)

I have also done

git remote add origin [email protected]:psdemo.git

Now: when I try to push, the following happens

git push origin master
fatal: 'psdemo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

It makes sense in a way since I just have an empty git repo.

How can I push my files to this remote server? I guess what I need is cloning from my local machine to the remote machine, somehow?

like image 620
stef Avatar asked Jul 20 '12 14:07

stef


People also ask

How do I push a project to git for the first time?

Initialize Git in the existing project If the existing project does not already use Git, issue a git init command in the root folder. After the repository is initialized, add all of the project files to the Git index and perform a commit: git add . git commit -m "Add existing project files prior to the push to GitHub."

How do I pull a project from GitHub for the first time?

Go to your repository on GitHub and you'll see a button “Compare & pull request” and click it. Please provide necessary details on what you've done (You can reference issues using “#”). Now submit the pull request. Congratulations!


1 Answers

The string

[email protected]:psdemo.git

should be a valid ssh path. As far as I see in the previous line:

git init
Initialized empty Git repository in /home/stefan/.git/

You created a repository in /home/stefan/ so I would expect something like:

[email protected]:~

But probably it isn't what you want. You should create a folder psdemo.git in your home in the remote server. For this, do a

git init --bare ~/psdemo.git

In that and then add the remote with:

 [email protected]:~/psdemo.git

Then you should be able to push!

like image 130
Aldo Stracquadanio Avatar answered Sep 24 '22 15:09

Aldo Stracquadanio