Setting up a new remote repository for Git over SSH


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Server Side
  2.  
  3. $ ssh server.com
  4. Last login: Thu Oct 1 10:32:15 2009 from 0.0.0.0
  5. $ mkdir /opt/git/project.git
  6. $ cd /opt/git/project.git
  7. $ git --bare init
  8. Initialized empty Git repository in /opt/git/project.git
  9. $ exit
  10. logout
  11. Connection to server.com closed.
  12.  
  13. Client Side - Project needs to be an existing local repository.
  14. See below how to create a local repository.
  15.  
  16. $ cd ~/git/project
  17. $ cd project
  18. $ git remote add origin ssh://server.com/opt/git/project.git
  19. $ git push origin master
  20.  
  21. Creating a local repository:
  22.  
  23. $ cd ~/git
  24. $ mkdir project
  25. $ cd project
  26. $ git init
  27. Initialized empty Git repository in /Users/user/git/project/.git/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.