簡體   English   中英

當我嘗試將代碼推送到github時,將會出現--global@github.com

[英]--global@github.com is coming up when I try to push my code to github

我無法找到答案,也許我只是在這里盲目地錯過了一步,但每當我嘗試將我的代碼推送到github並使用git push -u origin master時,它會提示輸入密碼“--global @ github .COM“:

我輸入了我的帳戶密碼,然后說

Password for 'https://--global@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 
'https://github.com/richardquirarte/QRealty.git/'

我已經使用了git config --global user.email並且驗證了它是我的電子郵件,但它仍然提出了這一點。

再次,抱歉,如果這是一個簡單的解決方案,我無法在任何地方找到答案。 謝謝。

你可能有一些糟糕的配置。

請先嘗試重置遠程網址和用戶名:

git config --global user.name "some user name"
git remote set-url origin https://github.com/richardquirarte/QRealty.git

這看起來像一個git config --global出錯了。

試試git config -l | grep global git config -l | grep global ,看看你是否有任何配置“ global ”。

如果沒有,請檢查您的git config credential.helper ,看看您是否必須刪除與GitHub URL關聯的用戶--global (請參閱“ 我將代碼推送到github.com時出現問題 ”)。

這是一個遲到的答案,但我有同樣的問題,並想出來。 我不小心將我的憑據用戶名設置為--global,所以當我被提示登錄時,我被提示登錄--global@github.com。

解決這個問題:

git config --global credential.username "your github username here"

要確保憑據用戶名是正確的:

git config -l

現在推送您的代碼。

git push 

您正在使用https,它需要密碼才能與服務器進行任何交互。
解決它並不難,但我建議你切換到ssh,你不必再使用密碼了。

閱讀他的文檔,了解如何。
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

簡而言之:

  • 生成ssh密鑰打開git bash並輸入: ssh-keygen
  • 一旦創建了ket,就將其復制(公共路徑將打印在您的終端中)
  • 將密鑰添加到您的GitHub帳戶
  • 將repo URL更新為新URL

     git remote set-url origin <ssh url> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM