\n","author":{"@type":"Person","name":"Jim Yang"},"upvoteCount":0,"answerCount":2,"acceptedAnswer":null}}
Reputation: 307
I was working on our lab server and Github kept asking my username and password every time I tried to push or pull. After done some searching, I tried this command git remote set-url origin git@github.com:username/repo.git
where username
is replaced by my email address. Now I seemed now able to push to my repo. Any suggestions on how to fix this? Thanks in advance.
Upvotes: 0
Views: 91
Reputation: 2478
If you use HTTP and don't mind your credentials being stored in plaintex you could use HTTP basic authentication:
https://username:password@git-repo/repo.git
#create a new remote with the authenticated url
git remote set-url authrepo https://username:password@git-repo.com/repo.git
#delete the old remote
git remote remove <your ocurrent remote>
#call the old remote the same as new remote
git remote rename authrepo <your current remote>
Upvotes: 0
Reputation: 83577
A URL like git@github.com:username/repo.git
uses the SSH protocol for authentication. You need to create a SSH key and upload the public key to GitHub. The GitHub docs explain how to do this in detail.
Upvotes: 2