mining
mining

Reputation: 3709

How to update the local repository from remote server successfully?

In github.org, B has a repository named helloworld.git, and two branches.

    http://github.org/B/helloworld.git:
        master
        dev   --> always updated.

I forked the repository into my account A, and create a new branch named test.

    http://githu.org/A/helloworld.git:
        master
        dev
        test  --> do my work and commit it into this branch

and I have checked out the repository into my local machine:

    git clone http://github.org/A/helloworld.git
    git checkout master
    git checkout dev
    git checkout test

then, I want to keep my local repository updated from B's repository:

    git remote add upstream http://github.org/B/helloworld.git
    git fetch upstream
    git checkout master
    git merge upstream/master
    git checkout dev
    git merge upstream/dev

and, if I using git status, it says Your branch is ahead of 'origin/dev' by 22 commits.

But, when I made a commit, there is a error:

    git checkout test
    (do some modifications in doc/Readme.md)
    git add doc/Readme.md
    git commit -am "modified doc/Readme.md"
    git push origin test

There is an error:

    fatal: Authentication failed

What's wrong? How could I do this work successfully? Thanks!

Upvotes: 1

Views: 219

Answers (1)

VonC
VonC

Reputation: 1329682

If you are using an https url for your origin repo, referencing your fork, then you need to enter your A GitHub account login/password as credential.

Check your current remote with git remote -v

I prefer adding the username in the url itself in order to enter only the password:

git remote set-url origin http://[email protected]/A/helloworld.git

Upvotes: 1

Related Questions