Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git:如何作为其他人承诺?_Git_Github - Fatal编程技术网

Git:如何作为其他人承诺?

Git:如何作为其他人承诺?,git,github,Git,Github,我在做一个自由职业者的项目。客户(我们叫他foobar)要求我使用他的github帐户上传代码(我的工作电脑运行64位Windows 10,我安装了git 2.15.0) 所以我做了这些步骤 转到凭据管理器->Windows凭据->通用凭据。删除了我的Github帐户 在源代码目录上,执行标准过程: git init git add * git commit -m "first message" git remote add origin https://github.com/foobar/su

我在做一个自由职业者的项目。客户(我们叫他foobar)要求我使用他的github帐户上传代码(我的工作电脑运行64位Windows 10,我安装了git 2.15.0)

所以我做了这些步骤

  • 转到凭据管理器->Windows凭据->通用凭据。删除了我的Github帐户

  • 在源代码目录上,执行标准过程:

    git init
    git add *
    git commit -m "first message"
    git remote add origin https://github.com/foobar/supersecretproject.git
    git push -u origin master
    
  • 出现Github凭据对话框。输入他的凭证


    等一会儿,代码被提交到Github。打开Github页面,奇怪的是显示的提交者是我,而不是foobar。奇怪。如何解决这个问题?我想提交为foobar

    您还需要为git配置您的姓名和电子邮件:

    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
    

    如果您只想更改一个回购的配置设置。您可以尝试以下步骤:

    git init
    git add *
    git commit -m "first message"
    git remote add origin https://github.com/foobar/supersecretproject.git
    git push -u origin master
    
    1) 在终端上,将当前工作目录更改为要在其中配置与Git提交关联的名称和电子邮件的本地存储库

    2) $ git config user.name "Elon Musk". 
    
    3) $ git config user.email "elonmusk@tesla.com"
    
    3) 确认您已正确设置Git用户名和电子邮件:

     $ git config user.name
    
    > Elon Musk
    
     $ git config user.email
    
    > elonmusk@tesla.com
    
    完成了!:)

    希望这能有所帮助

    可能重复的