mirror of https://github.com/go-gitea/gitea.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
632 B
24 lines
632 B
// Copyright 2015 The Gogs Authors. All rights reserved. |
|
// Copyright 2018 The Gitea Authors. All rights reserved. |
|
// SPDX-License-Identifier: MIT |
|
|
|
package git |
|
|
|
import ( |
|
"code.gitea.io/gitea/modules/git/gitcmd" |
|
) |
|
|
|
// BranchPrefix base dir of the branch information file store on git |
|
const BranchPrefix = "refs/heads/" |
|
|
|
// AddRemote adds a new remote to repository. |
|
func (repo *Repository) AddRemote(name, url string, fetch bool) error { |
|
cmd := gitcmd.NewCommand("remote", "add") |
|
if fetch { |
|
cmd.AddArguments("-f") |
|
} |
|
_, _, err := cmd.AddDynamicArguments(name, url). |
|
WithDir(repo.Path). |
|
RunStdString(repo.Ctx) |
|
return err |
|
}
|
|
|