push using repo instead of remote
This commit is contained in:
parent
f509136d92
commit
3fbad0b6ab
1 changed files with 4 additions and 5 deletions
9
main.go
9
main.go
|
@ -121,9 +121,9 @@ func CreateRemote(
|
||||||
|
|
||||||
func Push(
|
func Push(
|
||||||
auth *githttp.BasicAuth,
|
auth *githttp.BasicAuth,
|
||||||
remote *git.Remote,
|
r *git.Repository,
|
||||||
) error {
|
) error {
|
||||||
return remote.Push(&git.PushOptions{
|
return r.Push(&git.PushOptions{
|
||||||
RemoteName: DefaultRemoteName,
|
RemoteName: DefaultRemoteName,
|
||||||
Auth: auth,
|
Auth: auth,
|
||||||
})
|
})
|
||||||
|
@ -212,13 +212,12 @@ func main() {
|
||||||
Password: *password,
|
Password: *password,
|
||||||
}
|
}
|
||||||
|
|
||||||
remote, err := CreateRemote(repo, *remoteUrl)
|
if _, err := CreateRemote(repo, *remoteUrl); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("%s", err)
|
log.Fatalf("%s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *push == true {
|
if *push == true {
|
||||||
if err := Push(auth, remote); err != nil {
|
if err := Push(auth, repo); err != nil {
|
||||||
if err == git.NoErrAlreadyUpToDate {
|
if err == git.NoErrAlreadyUpToDate {
|
||||||
log.Println("Already up-to-date")
|
log.Println("Already up-to-date")
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue