Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

This is an experimental feature.  It is possible to lose your work when using git and this is only recommended for advanced users. You can get into a LOT of trouble if you are working with multiple developers simultaneously. If you are working by yourself this is reasonably safe. Before you try the following it is highly recommended that you understand the basics of git.

When git support is enabled a git repository will be created with each instance. When you push updates to the "master" branch of the repository these updates will automatically appear under htdocs/git/[instance name]. The safest way to use this feature is to only push updates from your workstation. It is possible to make changes locally on the server and commit the changes via phpshell but this is dangerous (only recommended for "development" repositories). You also want to be really wary of adding/modifying files that are under the "git" directory in "htdocs" unless you know what you're doing. Think of the "git" directory under htdocs as "read-only" and you'll be safe (it's possible to mingle non-git content, but you better understand what you're doing!).

If you want to have a "workflow" one option is to have 3 instances of "dev"/"test"/"production". You can actively muck with dev and push changes to "test" as things become stable and then push to production. This vastly over simplifies what is possible with git, but it's a starting point.

Step 1: git clone

From your splashpage URL find the git URL and clone to your workstation.

No Format
[emc256@emc256 tmp]$ git clone https://webhostXXX.kproxy.cornell.edu/git/cornelldev.git
Cloning into 'cornelldev'...
Username for 'https://webhostXXX.kproxy.cornell.edu': netid
Password for 'https://netid@webhostXXX.kproxy.cornell.edu':
warning: You appear to have cloned an empty repository.

Step 2: add files to local repo

The following creates a file "index.html" that contains "hello from git"

No Format
[cornelldev]$ echo "hello from git" > index.html

Add the file into your local git repo

No Format
[cornelldev]$ git add index.html

Add a description of your new file

No Format
[cornelldev]$ git commit -m 'added index.html'
[master (root-commit) 979fa78] added index.html
 Committer: Firstname Lastname <netid@cornell.edu>
 1 file changed, 1 insertion(+)
 create mode 100644 index.html

Step 3: publish changes to server

The following will push the content up to the server and publish it add https://webhostXXX.hosting.cornell.edu:XXXX/git/cornelldev (assuming the instance is named cornelldev)

No Format
[emc256@emc256 git]$ git push origin master
Username for 'https://webhostXXX.kproxy.cornell.edu': netid
Password for 'https://netid@webhostXXX.kproxy.cornell.edu':
Counting objects: 3, done.
Writing objects: 100% (3/3), 234 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: From /www/repos/git/cornelldev
remote:  * [new branch]      master     -> origin/master
To https://webhostXXXX.kproxy.cornell.edu/git/cornelldev.git
 * [new branch]      master -> master