1

I have a project inside of VS Code which uses git locally and everything is commited / up to date.

Now I want to push all that to my server so I can update files on the server while working locally.

I've set up my git repo on my server and connected from vs code project terminal, however when I do a push it says that everything is "up to date", and the folder on the server is empty, it contains just the .git folder.

I want to transfer all my project files to the folder on the server, how do I do that?

Right now I am doing:

git push origin --all 

And I get Everything is up to date

I also try doing:

git add.
git commit -m "commit message"

But I get

on branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

How can I send all my local git files to my server git repo?

jukenduit
  • 322
  • 3
  • 15

2 Answers2

0

In addition of git status and git remote -v, don't forget that you would generally push to a bare repository.

Meaning: the remote target should only have a .git folder with the compressed files received from your local workstation.

You would not see any files there (beside the ones from the Git referential).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • You are right, I've created a new empty project on my machine and cloned the repo there and I got all the files, so it is as you say, However I do actually want to see and use the files on my remote server, how can that be achieved? – jukenduit Aug 24 '19 at 05:26
  • Got it, By simply cloning it into another directory, thanks for helping me understand. – jukenduit Aug 24 '19 at 05:31
  • @jukenduit Yes, cloning, or setting up a post-receive hook which can make the clone/update for you: https://stackoverflow.com/a/14453711/6309 – VonC Aug 24 '19 at 12:36
0

Let's try this from the VSCode terminal.

1) Change the current working directory to your local repository (your project directory).

2) Stage the file for commit to your local repository.

git add .
# Adds the file to your local repository and stages it for commit.

3) Commit the file that you've staged in your local repository.

git commit -m "Your commit message here"
# Commits the tracked changes and prepares them to be pushed to a remote repository. 

4) Push the changes in your local repository to the repository hosted on remote server (Example: GitHub).

git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin
1218985
  • 7,531
  • 2
  • 25
  • 31