0

I have a django project under development on my windows computer (dev-machine). I am using pyCharm for development.

I have set up a server (server-machine) running ubuntu. And now want to push my project to the server.

So in my project folder on the dev-machine I have done the git init:

$ git init
$ git add .
$ git commit -m"Init of Git"

And on the server-machine I have made a project folder: /home/username/projects In this folder I init git as well

$ git init --bare

Back on my dev-machine, I set the connection to the server-machine by doing this

$ git remote add origin username@11.22.33.44:/home/username/projects

And finally pushing my project to server-machine by typing this command on my dev-machine

$ git push origin master

It starts to do ome transfer. And here's the problem.

On the server-machine when I check what's been transferred, it's only stuff like this

~/projects$ ls
branches  config  description  HEAD  hooks  info  objects  refs

Not a single file from the project is transferred. This looks much like what the .git folder contains on the dev-machine.

What am I doing wrong?

sumpen
  • 503
  • 6
  • 19
  • That's not how git works. You've pushed your changes to the copy of the repo on the server, but you also need to check out those changes locally there. – Daniel Roseman Oct 13 '17 at 09:14
  • You're not doing anything wrong. `git init --bare` creates a bare repository. A bare repository has no working tree, and thus you can't run `git checkout`. Please see https://stackoverflow.com/questions/37992400/what-is-a-bare-repository-and-why-would-i-need-one – ElpieKay Oct 13 '17 at 09:43
  • Possible duplicate of [What is the difference between "git init" and "git init --bare"?](https://stackoverflow.com/questions/7861184/what-is-the-difference-between-git-init-and-git-init-bare) – phd Oct 13 '17 at 11:14
  • I thought this would send the project as well. Isn't that possible at all? – sumpen Oct 13 '17 at 11:57

2 Answers2

0

What you see is the directory structure git uses to store your files and meta data. This is not a checked-out copy of the repository.

To check whether the data made it into the repository use git log in ~/project

Thomas Stets
  • 3,015
  • 4
  • 17
  • 29
  • I only see the _"Init of Git"_ commit I did on dev-machine. But how do I make sure my project are sent to the server-machine if this is not done with push? – sumpen Oct 13 '17 at 11:17
0

Okay, so I understand now where I went wrong.

With git push I am not setting up the project.

To set up the project I need to do git clone.

This is how I did it.

1. So I made a folder for git repositories on the server-machine. I called it /home/username/gitrepos/

2. Inside there, I made a folder for my project, where I push the git repository into. So path would look like this for me /home/username/gitrepos/projectname/

3. Being inside that folder I do a 'git init' like this

$ git init --bare

4. Then I push the git repo to this location. First setting the remote adress from my dev-machine with this command. If adding a remote destination new use this:

$ git remote set nameofconnection username@ip.ip.ip.ip:/home/username/gitrepos/projectname

if changing the adress for a remote destination use this:

$ git remote set-url nameofconnection username@ip.ip.ip.ip:/home/username/gitrepos/projectname

To se with remote destinations you have set type this:

$ git remote -v

5. Now go back to server-machine and clone the project into a project folder. I made a folder like this /home/username/projects/ When being inside that folder I clone from the gitrepo ike this:

$ git clone /home/username/gitrepos/projectname

Thank you all for the help! <3

sumpen
  • 503
  • 6
  • 19