This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KingofGamesYami's profile picture

[MC 1.10.2/1.11.2][CC 1.8pr0][CCTweaks 1.10.2-1.5.0-pr0 / 1.11.2-1.5.0-pr0] CCGit v2.1

Started by KingofGamesYami, 22 December 2016 - 02:08 PM
KingofGamesYami #1
Posted 22 December 2016 - 03:08 PM
CCGit 2.1 is out!
Get it here
Requires CCTweaks and ComputerCraft 1.8pr0

In 2.1 I've added a program which allows you to use git from the command line. Unfortunately this requires a little bit of setup on each new computer - simply run the following:

.ccgit/autorun
This will generate a program in the startup program which will set the appropriate shell variables to allow the program to function in any directory. If the startup file is ever deleted, don't worry! You can simply re-run the autorun.lua file.

1.x postEver wanted to be able to push and pull your work from github? Of course you have! And now you can!!
CCGit is an addon to computercraft (or rather, CCTweaks…) that adds several basic git functions. These include the ability to clone, push, pull, and commit to a real git repository!
Known Bugs:
A java exception is thrown by JGit when adding credentials. No idea what's causing it.
None!
Installation:
Download from github, place in mods folder. Requires CCTweaks and ComputerCraft, versions linked in release on github.
Usage:
If you are familiar with Git, you probably know how to use this. Documentation right now is pretty sparse, I will eventually write more. Currently I support the following:
Spoiler

ccgit.commit( gitDir, message )
gitDir is the location of the git folder, eg "lama/.git"
message is the commit message

ccgit.pull( gitDir, remote )
gitDir is the location of the git folder, eg "lama/.git"
remote is the name of the remote to pull from (eg "origin")

ccgit.push( gitDir, remote )
gitDir is the location of the git folder, eg "lama/.git"
remote is the name of the remote to push to (eg "origin")

ccgit.clone( remote, directory )
remote is the URI of the git, eg "https://github.com/KingofGamesYami/LAMA.git"
directory is the name of the directory to clone to (eg "lama")

ccgit.init( directory )
directory is the name of the directory to initialize a git repository in (eg "lama")

ccgit.addRemote( gitDir, name, uri )
gitDir is the location of the git folder, eg "lama/.git"
name is the name of the remote (eg "origin")
uri is the remote's URI, eg "https://github.com/KingofGamesYami/LAMA.git"

ccgit.getRemoteNames( gitDir )
gitDir is the location of the git folder, eg "lama/.git"

ccgit.setCredentials( username, password )
username is your Git account name (eg "KingofGamesYami")
password is, well, your password. No example for this one :P/>/>/>/>

ccgit.addAll( gitDir )
gitDir is the location of the git folder, eg "lama/.git"
Edited on 26 June 2017 - 01:36 AM
Lupus590 #2
Posted 22 December 2016 - 03:24 PM
I can imagine this being very useful for development in a multiplayer environment. +1 for you!

I won't be using it however as I do a lot of my development locally.

I would consider this a must have for developing big projects in multiplayer though.
KingofGamesYami #3
Posted 23 December 2016 - 10:38 PM
It appears the recent forum migration ate my post; v1.1 fixes the exception thrown by JGit during authentication.
TheOddByte #4
Posted 30 December 2016 - 08:39 PM
Would it be possible to add a function like getDirectories or something? Someone could actually create a git client with this.
Does it throw an error if the credentials is wrong? I mean when the function setCredentials is called.
KingofGamesYami #5
Posted 31 December 2016 - 12:11 AM
What would getDirectories do? Just list the repositories? If that's what it does, that can would be easier to implement in Lua, just search for .git folders. I'd love it if someone made a git client, even better would be integration with an editor.

No, setCredentials will not. However, if you need valid credentials for a function, that will error telling you credentials are incorrect.
Sewbacca #6
Posted 09 January 2017 - 03:04 PM
I doesn't use GitHub so often, but it seems good for pushing crash reports. Good job dude!
KingofGamesYami #7
Posted 16 June 2017 - 11:34 PM
CCGit has been rewritten and is now v2.0!
KingofGamesYami #8
Posted 26 June 2017 - 03:38 AM
CCGit v2.1 is out – This update adds a command-line program and ccgit.clone!

The documentation has also been updated, though some stylistic changes will be coming.