英文:
git push --set-upstream origin master
问题
I am trying to git push to a remote server with this command git push --set-upstream origin master as instructed. it brings me to a place where I have to enter my username and password but I am unable to enter my password or token. When I hit my keyboard, nothing shows.
What am I doing wrong here?
vagrant@ubuntu-focal:~/zero_day$ git push --set-upstream origin master
Username for 'https://github.com':
Password for 'https://skibanj@github.com':
Honestly I am clueless but I am expecting my codes to push now so I wont have to push with any arguments again.
英文:
I am trying to git push to a remote server with this command git push --set-upstream origin master as instructed. it brings me to a place where I have to enter my username and password but I am unable to enter my password or token. When I hit my keyboard, nothing shows.
What am I doing wrong here?
vagrant@ubuntu-focal:~/zero_day$ git push --set-upstream origin master
Username for 'https://github.com':
Password for 'https://skibanj@github.com':
Honestly I am clueless but I am expecting my codes to push now so I wont have to push with any arguments again.
答案1
得分: 2
以下是翻译好的内容:
看起来你正在使用从github.com通过https克隆的远程存储库。如果存储库是公开的,clone和fetch可以匿名进行,但向github进行push始终需要进行身份验证 - 使用你的github帐户。
当你需要向github进行push时,常用的方法是设置ssh访问并通过ssh访问github。
要做到这一点:
- 
要设置一个与你的帐户关联的ssh密钥并设置你自己的系统来使用它,请查看github上的步骤:
 - 
要更新你的本地存储库以指示git通过ssh访问github,只需更改你的
origin远程的URL:git remote set-url origin git@github.com:<path/to/repo> 
你也可以通过经过身份验证的https进行操作:
- 
如果你不经常进行
push,你可以保留你展示的工作流程,要求的用户名/密码是你在github上的凭据。 - 
你可以在git中设置存储或缓存你的密码:
参见 https://git-scm.com/docs/gitcredentials 
英文:
It looks like you are working with a remote repository which you cloned from github.com through https. If the repo is public, cloneing and fetching can be done anonymously, but pushing to github always require to authenticate -- with your github account.
The go to way when you need to push to github is to set up an ssh access and access github through ssh.
To do this:
- 
to set an ssh key linked to your account and set your own system to use it, check the procedure on github :
 - 
to update your local repo to instruct git to access github through ssh, just change the url of your
originremote :git remote set-url origin git@github.com:<path/to/repo> 
You may also go through authenticated https:
- 
if you don't push often, you may keep the workflow you show, the Username/Password that are asked are your credentials on github
 - 
you may set things up in git to store or cache your password :
see https://git-scm.com/docs/gitcredentials 
答案2
得分: 0
我遇到了同样的问题。你应该添加命令 "git push -u origin main",希望它能够起作用。
英文:
I had the same problem. You should add the command "git push -u origin main" I hope it will work.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论