How to backup octopress when I publish on Github - octopress

I launch my own octopress yesterday,
And our blog articles are stored under source folder/
however when I run rake deploy , it only push the public data to github server.
because the default .gitignore are as following
1
2 .bundle
3 .DS_Store
4 .sass-cache
5 .gist-cache
6 .pygments-cache
7 _deploy
8 public
9 sass.old
10 source.old
11 source/_stash
12 source/stylesheets/screen.css
13 vendor
14 node_modules
Is there any better way to put your source markdown file in the GitHub server, to avoid I delete the source code accidently.
Thanks

I don't see anything wrong with the gitignore file. Maybe your problem is with your git branch.
Try this $ git branch if it says master you have to rename the branch to source like this:
$ git branch -m master source
Then when you do $ git branch again it should say source
When you deploy you should git add, git commit then $git push origin source then rake deploy
Let me know if this works

rake deploy will push changes in _deploy folder to master branch.
After rake deploy, if you do git push origin source under ~/octopress folder then your posts will be pushed to the source branch of your repo.

Related

Git made 3 Gits And Now Not Working At All

Help!
I implemented Git to my project and somehow Git has made 3 files for saving my information: (1) Saves all of my view controllers, (2) The same file as (1), (3) my pods only.
The one containing my pods seems to be broken as I can not commit anything to it. First I thought nothing of these 3 Gits and proceeded coding, but now I am trying to branch my master with something I have been spending months coding but it seems to be crashing every time because it does not save my code to the master and makes me update my pods. Now after I tried to branch it, it did not work but now when I try to commit my files to the current branch I'm working on, it is not letting me without committing all 1600 files that are in my Pods. But the Pod file will not commit! I have no clue how to fix this and I am in desperate need of help!!!! Can anyone please help. I just want to have one place that will commit my files like in every Xcode git file. I do not want to lose my months of work.
I get the error: "The working copy “Pods” failed to commit files. - The source control operation failed because no repository could be found."
Please trouble shooting you issue with below aspects:
1. Use one git repository
If you mean 3 gits are 3 git repositories, you should keep only one git repo to manage your project. Only keep the repo that can contain all the files you want to manage under it’s directory.
As below example, if you project (the files you want to manage in git repo) is under Dir2 (not contains it’s parent Dir1), then you should remove the other two repos for Dir1 and Dir3 by removing the folders Dir1/.git and Dir1/Dir2/Dir3/.git.
Dir1
|___.git
|___ …
|___Dir2
|___.git
|___ …
|___Dir3
|___.git
|___ …
If you mean 3 gits are 3 git branches for the same git repo, before switching branches, you should make sure the work directory is clean (save and commit changes before switching branches).
2. Mark sure user.name and user.email has already been set
You can use the command git config -l to check if the output contains:
user.name=<username>
user.email=<email address>
If the output does not contain user.name and user.email, you should set as below:
git config --global user.name yourname
git config --global user.email xxx#xx.com

how to merge master into branch in github for windows?

I am new to github and try to merge master branch into my branch then commit my work ,how I can do that using github for windows .
open terminal cd to your local root
git add .
git commit -m "your commit"
git push
This will move all of your local changes to master
*If you are working with someone else that has updated code you will need to do a git pull before the push
If your trying to do a merge for a local branch use http://www.wdtutorials.com/drupal-7/github-windows-tutorial-3-branching-local-merging#.VYsBlRNVhBc
This is a pretty good github source for beginners.
http://rogerdudler.github.io/git-guide/

Octopress pushing error to GitHub

I'm trying to push an octopress to github page,everything has worked fine up to now but when i do the rake deploy command after displaying octopress files i get the following error
To git#github.com:rukshn/rukshn.github.io.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:rukshn/rukshn.github.io.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
what's the problem?
Since this is the master branch, i.e., the one running your generated pages, you need to drop into the _deploy directory, then do the git pull origin master. Somehow your deploy directory has gotten out of sync. Do you have more than one local repo you write to and deploy from? (Say on different machines...) If you do, then you should always make sure to sync your the sources on the various repos as well.
do
cd _deploy
git reset --hard origin/master
cd ..
and try again
rake generate
rake deploy
Try:
git checkout source
rake gen_deploy
#slavik comment works like a charm.
#Benjamin I think #rksh skipped below steps,
Don't forget to commit the source for your blog.
git add .
git commit -m 'add source code to source branch'
git push origin source
I met the problem and solved it by removing the master branch in the _deploy folder in the source branch. The detailed commands are as follows:
// change directory to _deploy
cd _deploy
// check out local master branch
git checkout master
// rename local master to master2
git branch -m master2
// list of remote branch
git branch -r
// create a new local master branch and tracking remote master branch
git checkout origin/master -b master
// pull the remote master branch, ensure that the local master branch has Already up-to-date.
git pull
// delete the local master2 branch if not needed.
git branch -d master2
```

Migrating forked project from Heroku to Github

Some time ago I found some code in one Github repo. I downloaded it (did not fork it), started upgrading it and when I was happy with the result, I used Heroku as a host. So now the code lives on my computer and Heroku. How could I push it to my Github account, but also give the original author of the project some credit for it (showing on my Github that I actually forked it)?
Okay, so I actually figured it out already!
First, create a new repository on github, let's name it github-project.
git clone git#heroku.com:<heroku-project>.git
cd <heroku-project>
git remote rm origin
git remote add github https://github.com/<github-username>/<github-project>
git pull github master
Now you'll probably see some conflicts. If you want to preserve all your changes, just add them all.
git add .
git commit -m "some message"
git push github master
This is quite simple:
Create an empty repository on GitHub, let's call it github-project
Clone from Heroku, let's call it heroku-project
Add a remote for github
Push to GitHub
The commands to perform these steps:
git clone git#heroku.com:heroku-project.git
cd heroku-project
git remote add github https://github.com/github-username/github-project
git push -u github master
That's it!
Note: if you already created the GitHub project with a README file in it, then it is NOT empty anymore, and the last push will be refused. In that case you can force the push, effectively overwriting the project on GitHub, by using the --force flag, for example:
git push -u github master --force

Clone failing against my new Windows 7 Git server using copssh, msysgit

I have created a git server on my Windows 7 box following Tim Davis' tutorial
Got everything working up to the part of actually trying to clone the repository.
I have a repo located on my server at:
C:\SSH\home\repos\testapp.git that I have initialized using git --bare init as per the tutorial, and try to clone it using GiT GUI via:
ssh://repos#myurl/SSH/home/repos/testapp.git
but get an error dialog popping up describing "Clone failed. Cannot determine HEAD. See console output for details." and "Couldn't find remote ref HEAD".
I tried making a new repo out of an existing project folder (hoping that this 'ref' would magically correct itself) but the same thing message occurs.
Is there something more after a '--bare' or an 'init' that needs to be done to set the head reference?
Most probably it's failing because it is an empty repository. You can try to add an initial ( dummy commit if needed ) to the repository and try the cloning again. Steps below if you don't know to do this.
Can you do this:
cd /home/repos
mkdir testapp.wd
cd testapp.wd
git clone ../testapp.git .
<now add some file>
touch README
git add README
git commit -m "Adding a initial commit"
git push origin master
cd ..
rm -rf testapp.wd
Now see if you can do the clone that you were trying.
If remote repository is empty, it will happen. Try to commit something.

Resources