How can I push a Git repository to a folder over SSH?

rich

I have a folder called my-project inside which I've done git init, git commit -a, etc.

Now I want to push it to an empty folder at /mnt/foo/bar on a remote server.

How can I do this?

I did try, based on what I'd read:

cd my-project
git remote add origin ssh://user@host/mnt/foo/bar/my-project.git
git push origin master

which didn't seem right (I'd assume source would come before destination) and it failed:

fatal: '/mnt/boxee/git/midwinter-physiotherapy.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I'd like this to work such that I don't have to access the remote host and manually init a Git repository every time ... do I have to do that? Am I going down the right route at all?

Thanks.

user1686

The command is correct; however, the remote address must point to an initialized Git repository too. It's a one-time job, though.

ssh user@host "git init --bare /mnt/foo/bar/my-project.git"

(In Git, a "bare" repository is one without a working tree.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I push project in specific folder in my GitHub repository?

From Dev

How can I push project in specific folder in my GitHub repository?

From Dev

How can I push a personal git repository on Launchpad?

From Dev

How can I make use of this git repository folder?

From Dev

How can I make use of this git repository folder?

From Dev

.git folder disappeared, how can I push my changes?

From Dev

I can not upload subfolders inside my folder repository using git push

From Dev

How can I push a git repo to a remote server through ssh?

From Dev

How can I push a git repo to a remote server through ssh?

From Dev

How can I revert a push to repository in GitHub

From Dev

How can I push and automatically update working copy of my non-bare remote git repository?

From Dev

How can I push the current state of my project, without git history, to a new remote repository?

From Dev

How can I push a Git repository to a server where it doesn’t yet exist

From Dev

How can I push the current state of my project, without git history, to a new remote repository?

From Dev

Git clone over ssh, push over https

From Dev

PhpStorm can not push to git repository

From Dev

How can I run glances over ssh?

From Dev

How can I run git push/pull commands with SSH verbose mode?

From Dev

How can I corrupt a Git repository?

From Dev

How can I tell the depth of a git repository?

From Dev

How can I add another repository in git?

From Dev

How can I uniquely identify a git repository

From Dev

How can I clear remote repository in git?

From Dev

How can I cache Yubikey/U2F credentials when authenticating over SSH (specifically Git)?

From Dev

How can I disable the MOTD when using Git over SSH on Windows?

From Java

How do I push amended commit to the remote Git repository?

From Dev

How can I convert a Git repository with branches to a workable Mercurial repository?

From Dev

How can I convert a Git repository with branches to a workable Mercurial repository?

From Dev

Can't Git Push to Mount Folder from Shared Windows Repository (Local Network)

Related Related

  1. 1

    How can I push project in specific folder in my GitHub repository?

  2. 2

    How can I push project in specific folder in my GitHub repository?

  3. 3

    How can I push a personal git repository on Launchpad?

  4. 4

    How can I make use of this git repository folder?

  5. 5

    How can I make use of this git repository folder?

  6. 6

    .git folder disappeared, how can I push my changes?

  7. 7

    I can not upload subfolders inside my folder repository using git push

  8. 8

    How can I push a git repo to a remote server through ssh?

  9. 9

    How can I push a git repo to a remote server through ssh?

  10. 10

    How can I revert a push to repository in GitHub

  11. 11

    How can I push and automatically update working copy of my non-bare remote git repository?

  12. 12

    How can I push the current state of my project, without git history, to a new remote repository?

  13. 13

    How can I push a Git repository to a server where it doesn’t yet exist

  14. 14

    How can I push the current state of my project, without git history, to a new remote repository?

  15. 15

    Git clone over ssh, push over https

  16. 16

    PhpStorm can not push to git repository

  17. 17

    How can I run glances over ssh?

  18. 18

    How can I run git push/pull commands with SSH verbose mode?

  19. 19

    How can I corrupt a Git repository?

  20. 20

    How can I tell the depth of a git repository?

  21. 21

    How can I add another repository in git?

  22. 22

    How can I uniquely identify a git repository

  23. 23

    How can I clear remote repository in git?

  24. 24

    How can I cache Yubikey/U2F credentials when authenticating over SSH (specifically Git)?

  25. 25

    How can I disable the MOTD when using Git over SSH on Windows?

  26. 26

    How do I push amended commit to the remote Git repository?

  27. 27

    How can I convert a Git repository with branches to a workable Mercurial repository?

  28. 28

    How can I convert a Git repository with branches to a workable Mercurial repository?

  29. 29

    Can't Git Push to Mount Folder from Shared Windows Repository (Local Network)

HotTag

Archive