Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to add a remote via REST API ?

gianluigimammarella1 July 24, 2018

I am able to create a repository via REST API but now I need to add a secondary remote to the repository, specifically a remote to a gitlab repository.

What I usually do from command line is:
git remote add secondremote git@gitlab.com:path/to-gitlab-repo.git

I can't figure out how or if it is possible to achieve the same result with REST API.

1 answer

0 votes
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2018

That git command only affects your local copy of the repo. What are you trying to do with the REST API?

gianluigimammarella1 July 24, 2018

Hi James, I'd like to know if exists an API to achieve the same result of the git command "git remote add..." without the needs to checkout a copy of the repo.

I mean something like POST "/repository/{slug}/remote" in order to add a remote only by API.

Thanks
Gianluigi

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2018

What are you trying to achieve with that? Are you trying to have all clones of the repo use the same set of remotes?

gianluigimammarella1 July 24, 2018

My need is to create a repo via API, and this is ok, and then add to this repo a remote pointing to a repo from Gitlab.

This because my project needs to update source code from the repo from gitlab and add some other code which will not be shared to the repo from gitlab.

I don't know exactly but i think it's like to have a fork of the repo from gitlab.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events