Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

eclipse - egit - not authorized

I just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.

Then I tried to "Fetch from Upstream". I got this error:

https://github.com/biunlp/nlp-lab.git: not authorized

I had no chance of entering my username and password...

This is strange since I connected to this repository in order to clone...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

A. To specify credentials individually for each remote

  1. Open Git repositories view,
  2. open "Remotes > origin > <your push url>"
  3. click "Change Credentials..."

push menu

(From User Guide - Resource Context Menu)

B. To specify credentials per server

If you want to access multiple repositories on the same server without providing the same credentials multiple times, you may use .netrc. With this, eGit will use the configuration you provide.

  1. Create a text file called .netrc (_netrc in Windows) in the user home directory.
  2. Add content to the file in this form:
    machine my.server1.com
    login yourUserName
    password yourPassword

    machine my.server2.com
    login yourUserName
    password yourPassword

The Stash documentation contains more information about .netrc

Security issue The problem with using .netrc this way is that the password is visible in plain text. Refer to this answer in Stackoverflow to solve that problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...