Is it possible to do a git push within a Gitlab-CI without SSH?

gitlab ci push to repo
gitlab ci push back to repo
gitlab ci commit back to repo
gitlab push from pipeline
gitlab ci remote: you are not allowed to upload code.
gitlab ci variables
gitlab-ci-token
gitlab ci commit to repo

We want to know if it's technically possible like in GitHub, to do a git push using https protocol and not ssh and without using directly an username and password in the curl request.

I have seen people that seem to think it is possible, we weren't able to prove it.

Is there any proof or witness out there than can confirm such a feature that allow you to push using a user access token or the gitlab-ci-token within the CI?


I was not able to push back via https from a Docker executor when I did changes in the repository which was cloned by gitlab-runner. Therefore, I use following workaround:

  1. Clone a repository to some temporary location via https with a user access token.
  2. Do some Git work (like merging, or tagging).
  3. Push changes back.

I have a job in the .gitlab-ci.yml:

tagMaster:
  stage: finalize
  script: ./tag_master.sh
  only:
  - master
  except:
  - tags

and then I have a shell script tag_master.sh with Git commands:

#!/usr/bin/env bash

OPC_VERSION=`gradle -q opcVersion`
CI_PIPELINE_ID=${CI_PIPELINE_ID:-00000}

mkdir /tmp/git-tag
cd /tmp/git-tag
git clone https://deployer-token:$DEPLOYER_TOKEN@my.company.com/my-user/my-repo.git
cd my-repo
git config user.email deployer@my.company.com
git config user.name 'Deployer'
git checkout master
git pull
git tag -a -m "[GitLab Runner] Tag ${OPC_VERSION}-${CI_PIPELINE_ID}" ${OPC_VERSION}-${CI_PIPELINE_ID}
git push --tags

This works well.

Git push from inside a gitlab-runner - GitLab CI, Currently the CI has no good possibility to push changes back to the allow masters to define, whether or not a build process in this project may push. If allowed, the generated token gets write access ONLY to the branch, which triggered the for your information whoami printenv # we need to extract the ssh/​git URL as the  A GitLab CI runner cannot yet push to a repo: there is a proposal in progress here.. In the meantime, you can use an SSH URL, with:. An SSH private key is defined as a secret variable through the Settings > CI/CD Pipelines web interface in GitLab, and


I am giving my before_script.sh that can be used within any .gitlab-ci.yml

before_script:
  - ./before_script.sh

All you need is to set a protected environment variable called GL_TOKEN or GITLAB_TOKEN within your project.

if [[ -v "GL_TOKEN" || -v "GITLAB_TOKEN" ]]; then
  if [[ "${CI_PROJECT_URL}" =~ (([^/]*/){3}) ]]; then
    mkdir -p $HOME/.config/git
    echo "${BASH_REMATCH[1]/:\/\//://gitlab-ci-token:${GL_TOKEN:-$GITLAB_TOKEN}@}" > $HOME/.config/git/credentials
    git config --global credential.helper store
  fi
fi

It doesn't require to change the default git strategy and it will work fine with non protected branch using the default gitlab-ci-token.

On a protected branch, you can use the git push command as usual.

We stopped using SSH keys, Vít Kotačka answers helped us understand why it was failing before.

Feature Request: Allow runners to push via their CI token, We want to know if it's technically possible like in GitHub, to do a git push using https protocol and not ssh and without using directly an username and password​  It doesn't require to change the default git strategy and it will work fine with non protected branch using the default gitlab-ci-token. On a protected branch, you can use the git push command as usual. We stopped using SSH keys, Vít Kotačka answers helped us understand why it was failing before.


I think you have to add your public key into gitlab in below address

gitlab.com/profile/keys

so you can push && pull without username password

Is it possible to do a git push within a Gitlab-CI without SSH?, Gitlab CI runner image that pushes to a remote Git repo (Dokku, Heroku, Deis, etc​.) Make sure your private ssh key is not encrypted, or Gitlab won't be able to If it is, you can decrypt it by running: openssl rsa -in enc.key -out dec.key  GitLab and SSH keys. Git is a distributed version control system, which means you can work locally. In addition, you can also share or “push” your changes to other servers. GitLab supports secure communication between Git and its servers using SSH keys.


IlyaSemenov/gitlab-ci-git-push: Gitlab CI runner image that , Gitlab-CI can be used to automatically deploy a Dokku application using the to the repository in question and visit the following path: the Gitlab project > Settings > CI/CD. Protected: Do not check this checkbox unless you know what you are doing only: - master script: - git-push ssh://dokku@dokku.me:22/$APP_NAME. Gitlab CI how to deploy an application via SSH. Ask Question a secret variable within gitlab-ci.yaml and use it during a shared ssh key to push things up from


Deploying with Gitlab CI, I would like to use GitLab CI in order to be able to separate rebuilding a Jekyll site I most definitely do not want to use my Jekyll project to learn the basics, since this Pushing To A Heroku Repository Without An SSH Key. The value is specified in bytes, so in the above case the buffer size has been set to 50MB. The default is 1MB. Check your SSH configuration. If pushing over SSH, first check your SSH configuration as ‘Broken pipe’ errors can sometimes be caused by underlying issues with SSH (such as authentication).


Deploying Jekyll to Heroku using GitLab CI, You have launched or are otherwise running the Bitnami GitLab CE Stack and the Bitnami Jenkins Stack. This is where you and your team will push code changes, and this will also be the Note the SSH URL to the repository, as you will need it in the next step The production branch does not exist yet. Testing a Phoenix application with GitLab CI/CD Phoenix is a web development framework written in Elixir , which is a functional language designed for productivity and maintainability that runs on the Erlang VM .