推送到远程的问题:org.ajoberstar.grgit.exception.GrgitException:

时间:2016-06-03 19:38:27

标签: git gradle grgit

我有一个将标签推送到存储库的任务:

task tagRepo << {

def gitTagName = 'a11'
def gitTagMessage = 'This s a new tag'
def gitUserName = 'uname'
def gitPassword = 'password'

def credentials = new org.ajoberstar.grgit.Credentials(gitUserName, gitPassword)

def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.rootDir.absolutePath, creds: credentials)

def remotes = grgit.remote.list()
logger.info('git remotes size - ' + remotes.size())
logger.info('git remotes - ' + remotes)

def central = remotes.find { it.name == 'central' }
if (!central) {
    def gitRepoLocation = 'git@bitbucket.org/bluetooth1.git'
    grgit.remote.add(name: 'central', url: gitRepoLocation)
}

grgit.tag.add(name: gitTagName, message: gitTagMessage)
grgit.push(remote: 'central', tag:true)

}

我得到以下输出: enter image description here

它抱怨凭据但凭据正确且具有适当的权限

1 个答案:

答案 0 :(得分:0)

如果您尝试使用Bitbucket用户名和密码作为身份验证,则应使用HTTPS URL,而不是SSH URL:

https://bitbucket.org/bluetooth1.git