Last active
February 22, 2016 19:06
-
-
Save ItsMeAra/4422067 to your computer and use it in GitHub Desktop.
Use SSH to set up your own Git repos on your server. http://net.tutsplus.com/tutorials/tools-and-tips/ssh-what-and-how/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh user@example.com | |
$ cd /path/to/repo | |
$ git init | |
$ git checkout -b staging | |
$ git checkout master | |
$ exit | |
$ cd /local/repo | |
$ git init | |
$ git add . | |
$ git commit -am "some message" | |
$ git remote add origin user@example.com:/path/to/repo | |
$ git checkout -b staging | |
$ git push origin staging | |
$ ssh user@example.com | |
$ cd /path/to/repo | |
$ git merge staging | |
Essentially what is happening here is you are logging into the server, changing to the desired repo path, | |
creating a repository and adding a “staging” branch which you can push to from your local machine. | |
Then, you are creating your local repo and a corresponding “staging” branch on your local machine, | |
and adding files to track to the repo. Next comes an initial commit. You are then adding the remote repository | |
as an alias of “origin”. Next, you are pushing the local staging branch to the “origin” alias’s staging branch. | |
Finally, you are ssh’ing back into the server and merging the “staging” branch with the default “master” branch. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment