Reputation: 287
I have an existing website hosting on dedicated server and I now want to setup the site to be backed up onto Github. So I created an account on github.com and created the repo lets call it websitea.com now my question is is there a way I can push the website files from the website server into the github repo without first downloading the entire site to my local machine and then using netbeans or some other IDE to push it up to github?
Yes I am new to using Git and trying to learn it. My goal is to get the entire site into the github repo and then use netbeans as my IDE to pull down some files I want to work on then I am thinking I would create a branch and upload the newly edited files to that branch on github and then merge them with the master once we have a few edited files that have been reviewed and are ready to be merged. Is my workflow sound correct?
So I ssh (via putty) into the dedicated server that hosts the website I want to backup into the Github repo. Once ssh'ed in I do the following commands:
eval "$(ssh-agent -s)" that gets me the below output Agent pid 10019
I then type ssh-add ~/.ssh/id_rsa I then type cat ~/.ssh/id_rsa.pub because the pbcopy command does not seem to work I then copy and paste that key that is shown into the github key text box to add that key to github and I give it a name "my desktop key"
I then go back to putty and type git remote add origin https://github.com/xxx/xxx.git of course replacing the x'es with the correct values and I get a fatal: remote origin already exists message but thats ok
I then type git push -u origin master and am still getting the Permission denied (publickey). message ???
Upvotes: 0
Views: 395
Reputation: 1173
is is there a way I can push the website files from the website server into the github repo without first downloading the entire site to my local machine
I think that to push from a remote web server to github, you need to be able to ssh
into that machine:
ssh your-user-name@your-web-server
Once you ssh into the machine you need to do the following:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
pbcopy < ~/.ssh/id_rsa.pub
Add the copied key to Github by following these instructions
git remote add origin https://github.com/<your-github-username>/<repository-you-created>.git
git push -u origin master
My goal is to get the entire site into the github repo and then use netbeans as my IDE to pull down some files I want to work on then
Github does not work by checking out individual files from the repository, making changes to them and then submitting that "changeset". In CVS like perforce is easy to do partial checkouts, while it is currently next to impossible in Git. You need to clone the entire repository from github, then make changes to the files you want and commit them to github
Upvotes: 1
Reputation: 142622
My goal is to get the entire site into the github repo and then use netbeans as my IDE to pull down some files I want to work on then
Open a new repository in git hub and follow the instruction of the page.
As you can see in the image below you will get all the info you need.
Is my workflow sound correct? Sounds good, also checkout the gitflow
Upvotes: 1