執行git push命令異常,如下:
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags --set-upstream origin refs/heads/master:refs/heads/master Pushing to https://github.com/gongyuhonglou/PlaylistVaporServer_Swift.git fatal: could not read Username for 'https://github.com': Device not configured Completed with errors, see above
原因:
.git文件下 config文件中url/pushurl沒有用戶身份信息:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = https://github.com/gongyuhonglou/PlaylistVaporServer_Swift.git fetch = +refs/heads/*:refs/remotes/origin/* pushurl = https://github.com/gongyuhonglou/PlaylistVaporServer_Swift.git [branch "master"] remote = origin merge = refs/heads/master
解決:
在請求串中加入身份信息即可,格式為:
https://[userName]:[password]@github.com/[username]/project.git
修改后:
[remote "origin"] url = http://gongyuhonglou:000000@github.com/gongyuhonglou/PlaylistVaporServer_Swift.git fetch = +refs/heads/*:refs/remotes/origin/*
注:000000代表密碼
如果還是不能解決的話,就在終端操作git push:(提示手動輸入github賬號和密碼)
macdeMacBook-Pro:Vapor mac$ git push Username for 'https://github.com': github賬號 Password for 'https://wengrp@yeah.net@github.com': github密碼 Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done.