git - libgit2sharp unable to do a repository push - Unable to evaluate expression because the code is optimized -
when debugging using repository network object quick watch of instance tells me threads need running, causes message in title. not sure why case when doing push message.
this real issue here why push below not work versus removing , re-adding remote.
code below - parameter values valid. commits local repo working. signature works using remote after removal , re-add of remote. branch correct in case below.:
private repository getgitrepo() { string path = settings.getsetting(constants.gitrepositorypath); repository repo = new repository(path); return repo; } using (var repo = getgitrepo()) { if(commit != null) { var options = new pushoptions(); options.credentialsprovider = new credentialshandler( (_url, _user, _cred) => new usernamepasswordcredentials() { username = settings.getsetting(constants.gitusername), password = settings.getsetting(constants.gitpassword) }); repo.network.push(_workingbranch, options); } }
anyone else run across issue or idea may missing?
thanks in advance!
so here worked. message stated in question think masking issue. removing , re-adding remote did trick. code posted below:
using (var repo = getgitrepo()) { // clean remote remove , re-add var remotename = settings.getsetting(constants.gitusername); repo.network.remotes.remove(remotename); remote remote = repo.network.remotes.add(remotename, settings.getsetting(constants.gitserver)); // build credentials repo in pushoptions var options = new pushoptions(); options.credentialsprovider = new credentialshandler( (_url, _user, _cred) => new usernamepasswordcredentials() { username = settings.getsetting(constants.gitusername), password = settings.getsetting(constants.gitpassword) }); var pushrefspec = _workingbranch.canonicalname; repo.network.push(remote, pushrefspec, options); }
Comments
Post a Comment