Skip to content

Push #463

@rafaelfaria

Description

@rafaelfaria

Guys,

I promise that before i posted this i looked everywhere, and tried to understand the documentation the best i could, but because there is no description on the methods in the documentation it's been pretty hard to decipher what needs to be done.

I'm trying to do a simple push, but nothing i do it seems be working.

The example it's commited on this repo, it create a repo. In my case it already exists. So instead of "create" im trying to use 'load'. Again, because o f the lack of the description i'm not even sure if that's the right way to do it. I'm basing myself from the tests. I saw a few functions using load.

var repo;

nodegit.Repository.open(repoFolder)
    .then(function(repoResult) {
        repo = repoResult;
        return repoResult.openIndex();
    })

         ... COMMIT FUNCTION HERE IS ALREADY WORKING ..

    .then(function() {
        return nodegit.Remote.load(repo, "origin").then(function(remote) { 
                remote.connect(nodegit.Enums.DIRECTION.PUSH);
                remote.setCallbacks({
                    credentials: function(url, userName) {
                        return nodegit.Cred.sshKeyFromAgent(userName);
                    }
                });

                console.log('Connected?', remote.connected())

                console.log(remote.push) // this returns undefined
             });

    })

This returns "Connected? 0".

I know i need to do a push in the remote, but for some reason the "push" method is undefined.

Please.... i'm pretty frustrated. Being trying to get this working for about 5 hours now, trying to do a simple push from my origin.

Any help would be appreciated.

Thanks

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