git push –set-upstream origin master

huangapple go评论58阅读模式
英文:

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克隆的远程存储库。如果存储库是公开的,clonefetch可以匿名进行,但向github进行push始终需要进行身份验证 - 使用你的github帐户。

当你需要向github进行push时,常用的方法是设置ssh访问并通过ssh访问github。

要做到这一点:

  • 要设置一个与你的帐户关联的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 :

    Adding a new SSH key to your GitHub account

  • to update your local repo to instruct git to access github through ssh, just change the url of your origin remote :

    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.

huangapple
  • 本文由 发表于 2023年5月11日 13:47:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76224473.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定