27 May 2019: This post has been transferred to my company’s developer guides as a public page at: https://www.vylesk.com/developer-docs/working-with-git/.
When you need to add a clean workspace in Cloud9 online IDE (c9.io) to a Bitbuck (or GitHub) repository after it is created (that is, when it is not already connected to source control).
Steps to make it happen:
- Create a new repo in Bitbucket.
- “git init” from command-line in the directory to act as the root of the new repo.
- Run “git remote add …” (e.g. “git remote add origin email@example.com:jsnelders/wp-test.git”)
- Run “git add” and “git commit -m” command to add files to Git staging, then commit (with a comment).
- Run “git push” to push the committed files to the origin
You can also:
- Add a .gitignore file.
- For WordPress, it may be worth adding “wp-config.php” to the .gitignore, depending on whether you store sensitive information (passwords, API keys) in the file.
- Inspiration found at: https://community.c9.io/t/instructions-to-port-push-cloud9-workspace-to-github/16830/19
- Ignoring files in Git: https://help.github.com/articles/ignoring-files/