Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Error: Reference 'refs/remotes/user/foo/HEAD' not found #523

Copy link
Copy link
@vasiliyb

Description

@vasiliyb
Issue body actions

Folks, I have a branch called user/foo that I'd like to check out from remote. Code:

Git.prototype.refresh = function refresh(branch) {
    var repository;

    var options = {
        credentials: function() {
            return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
        },
        certificateCheck: function() {
            return 1;
        }
    };

    return NodeGit.Repository.open(localPath).then(function (repo) {
        repository = repo;

        return repository.checkoutBranch(branch, options).then(function (checkoutresult) {

            return repository.fetchAll(options).then(function (result) {
                return Promise.resolve(result);
            }).catch(function (err) {
                console.log('Unable to fetch',err);
                return Promise.reject(new Error(err));
            });
        }).catch(function(err) {
            console.log('checkoutBranch',err);
            return Promise.reject(new Error(err));
        });
    });
};

error:

[Error: Error: Reference 'refs/remotes/user/foo/HEAD' not found]

Am I using checkoutBranch incorrectly? I already have the remote cloned to a local directory, and am trying to switch to a particular branch.

Thanks!

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.