Can I keep the git repository name in a CircleCI workspace?

git

#1

My project configures its artifact name using the name of the project root directory. Is it possible to configure CircleCI 2.0 to checkout the git repository to a directory with the same name (i.e., the default behaviour of git clone)?

(also asked on StackOverflow: https://stackoverflow.com/questions/48823009/can-i-keep-the-git-repository-name-in-a-circleci-workspace)


#2

As far as I understand it, you can omit the checkout step and just replace it with your own run: git clone ... command, and from there you can do anything you like.


#3

Answered on Stack Overflow and reposting here:

Yes.

You can do so either by telling the checkout command the name of the direction: https://circleci.com/docs/2.0/configuration-reference/#checkout

Or by setting a custom working_directory: https://circleci.com/docs/2.0/configuration-reference/#job_name

Respectfully,

Ricardo N Feliciano
Developer Evangelist, CircleCI


#4

Thanks! But that means that I have to store the name of my repository in .circleci/config.yml, right? That would defeat the purpose for me.


#5

What’s wrong with doing that?

Regardless, you can store the name as a string in a private environment variable, then use it with git clone to clone the repo.


#6

There’s nothing inherently wrong with it, but I have a use-case where I would like to avoid it.

Manually using git clone sounds like a good work-around. Thanks!


#7

FYI - I solved my use-case by setting the artifact name to $CIRCLE_PROJECT_REPONAME within the build itself.


#8