Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push to github from cloud9?

I am trying to push some changes from cloud9 to a github repository but I am hitting a roadblock.

I can clone OK with ssh, and everything seems to be OK, I make my changes, save the changes in cloud9 (when I go back the changes are still there), then I do git commit and get:

no changes added to commit (use "git add" and/or "git commit -a")

but I just need to commit changes to an existing file not to add. So obviously when I try to git push origin master there's nothing to push.

I tried with multiple github repos and I get the same result.

What am I missing?

Any help appreciated!

P.S. Oh, btw I suck at git

like image 981
JohnIdol Avatar asked Sep 08 '11 22:09

JohnIdol


People also ask

How do I push directly to GitHub?

In the command line, navigate to the root directory of your project. Initialize the local directory as a Git repository. To create a repository for your project on GitHub, use the gh repo create subcommand. When prompted, select Push an existing local repository to GitHub and enter the desired name for your repository.


2 Answers

The message shows that you are not adding changed/tracked files to commit.

Try with -am switch to ADD and Commit in one operation:

git commit -am "your message goes here"
git push
like image 148
Sarfraz Avatar answered Sep 22 '22 15:09

Sarfraz


Git separates committing from adding changes. You first have to add all changes you want to appear in the commit:

#1: Add any new files as part of the commit
#   or use git add -p to interactively select hunks to stage
git add file1 file2 …

#2: Commit to local
git commit -m "Commit message goes here"

#3: Push your commit/changes to the host (github)
git push

You should now have all your changes on github.

Alternatively, you can do the commit, and add/modify in one line, this may include undesired files into your changeset.

#1 Add files commit to local
git commit -a -m "Commit message goes here"

#2 Push your commit/messages to the host (github)
git push
like image 27
knittl Avatar answered Sep 20 '22 15:09

knittl