You can download binaries for Linux, MacOS or Windows from the release tab and put them in your path.
Linux example:
cd /tmp
wget https://github.com/wpueschel/gitrc/releases/download/v0.2.4/gitrc-linux-amd64
sudo cp gitrc-linux-amd64 /usr/local/bin/gitrc
sudo chmod 755 /usr/local/bin/gitrc
rm gitrc-linux-amd64
Building from source requires a setup Go environment with GOPATH etc. correctly set. Also, git and make are mandatory.
Linux example:
mkdir -p $GOPATH/src/github.com/wpueschel
cd $GOPATH/src/github.com/wpueschel
git clone https://github.com/wpueschel/gitrc.git
cd gitrc
# git checkout [tag] to build a stable version, master is not guaranteed to work at all times.
make dep linux
sudo cp gitrc-linux-amd64 /usr/local/bin/gitrc
make clean
Building for other systems:
make
ormake all
Builds gitrc for Linux, MacOS and Windowsmake dep darwin
Builds gitrc for MacOSmake dep windows
Builds gitrc for Windows
All build targets build an amd64 binary.
Requires a setup go environment.
Linux example:
go get github.com/wpueschel/gitrc
sudo cp $GOPATH/bin/gitrc /usr/local/bin
This will work, as long a the master branch builds/works. However, gitrc version
will not work properly.
gitrc [options] [provider]
Provider may be gitea, github or gitlab.
Detailed usage information will be given by issuing
gitrc -h [provider]
mkdir test-repo
cd test-repo
gitrc -N github
This will create a new repository named test-repo on github, put a basic README.md in it and clone it into the directory test-repo. If you use this with an additional -P, it will create a private repository.
gitrc -n test-repo github
This will create a new remote repository named test-repo with a basic README.md in it. With an added -P it will create a private repository.
gitrc -l gitea
This will list all repositories of your configured gitea, sorted by last commit.
gitrc -L gitlab
This will list all repositories on your configured gitlab with name and clone URL, sorted by last commit.
gitrc -n test-repo -D github
This will delete an existing repository on github. Be carefull though, there's no second thought. It's just being deleted.
Some of the options have to be put into a config file (mainly credentials). The config file has to be valid JSON. See the examples directory for an example config file.
The default location where gitrc will look for the config file will be $HOME/.gitrc.json
Right now, for gitea, only http/https will work for cloning a remote repository (-N). You will need a gitea access token.
For Gitlab, if you don't set a group in the config file, the group will be the username.
If you chose ssh as cloning protocol, which is the default, you will need a running and configured ssh agent. And the gitlab host should already be in your known_hosts file.
Password in the config will only be needed if you clone via http.
ssh cloning is the default. Same as with GitLab. You will need a running and configured ssh-agent and the host github.com should be already in your known_host file.
Password in the config will only be needed if you clone via http.