Git commands within circle.yml


#1

Hi there. As part of my CI process for a dockerized python service, I’d like to perform some git commands. I’m running into permissioning issues.

I have a private Github organization with multiple repos in it. As part of the CI process for one repo, I’m trying to commit (configuration) to another one. Here are the specific commands I’m using.

- git clone https://github.com/ezephoenix/risk-config.git
- cp docker-compose.yml risk-config/rancher/risk/
- cd risk-config && git status
- cd risk-config && git add -A
- cd risk-config && git commit -m "Updated config"
- cd risk-config && git push

I get an error on the git clone. I assume the CircleCI build agent is not permissioned to see this repo. This repo is in the same Github organization as the one the build is running against, though. Anyone in that Github organization should be able to see all repos.

Is there some kind of git login command I should be running?

git clone https://github.com/ezephoenix/risk-config.git
Cloning into 'risk-config'...
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.

**ERROR: Repository not found.**
**fatal: Could not read from remote repository.**

Please make sure you have the correct access rights

and the repository exists. git clone https://github.com/ezephoenix/risk-config.git returned exit code 128

#2

Use the SSH connection to GitHub instead of HTTPS. That may help with permissions. I had a similar issue because you have to give a password with HTTPS, but you can’t do that in the script. SSH doesn’t require a password. Anyways, I’m no expert, but it might be worth a try.


#3

This is totally right, we only support working with git via SSH.


#4