如何在Windows7上配置GIT以将项目推送到Google代码

如何在Windows7上配置GIT以将项目推送到Google代码,git,windows-7,google-code,.netrc,Git,Windows 7,Google Code,.netrc,我想把我的项目推到谷歌代码 我创建了一个新项目,在tab Source中,我得到了一些关于如何推送本地代码的说明 我在Windows7上工作,所以我创建了一个目录 C:\googlecode 我把文件放在那里 _netrc 里面 machine code.google.com login myloginhere@gmail.com password MySecretCodeHere 之后,我添加了新的系统变量(对不起,我使用的是非英语版本的Windows) 我点击OK,OK 按照说明,我

我想把我的项目推到谷歌代码

我创建了一个新项目,在tab Source中,我得到了一些关于如何推送本地代码的说明

我在Windows7上工作,所以我创建了一个目录

C:\googlecode
我把文件放在那里

_netrc
里面

machine code.google.com login myloginhere@gmail.com password MySecretCodeHere
之后,我添加了新的系统变量(对不起,我使用的是非英语版本的Windows)

我点击OK,OK

按照说明,我克隆了此回购协议:

git clone https://path/to/repo
我添加了一个新的自述文件

touch README
git add *
git commit -m "README"
git push origin master
这里我有一个错误:

fatal: remote error: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.goo
gle.com/hosting/settings
我还应该做些什么才能让它发挥作用


我重新启动了计算机并运行命令
SET HOME

我将
git-credential-netrc
文件复制到driectory

C:\Users\Aleksander\Documents\googlemagic
检查:

然后,我带着我的回购协议去了工厂,运行了一个命令

git config credential.helper netrc -d -v
它打印了一个输出:

usage: git config [options]

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
    -f, --file <file>     use given config file
    --blob <blob-id>      read config from given blob object

Action
    --get                 get value: name [value-regex]
    --get-all             get all values: key [value-regex]
    --get-regexp          get values for regexp: name-regex [value-regex]
    --replace-all         replace all matching variables: name value [value_rege
x]
    --add                 add a new variable: name value
    --unset               remove a variable: name [value-regex]
    --unset-all           remove all matches: name [value-regex]
    --rename-section      rename section: old-name new-name
    --remove-section      remove a section: name
    -l, --list            list all
    -e, --edit            open an editor
    --get-color <slot>    find the color configured: [default]
    --get-colorbool <slot>
                          find the color setting: [stdout-is-tty]

Type
    --bool                value is "true" or "false"
    --int                 value is decimal number
    --bool-or-int         value is --bool or --int
    --path                value is a path (file or directory name)

Other
    -z, --null            terminate values with NUL byte
    --includes            respect include directives on lookup
或者更改选项
-d-v
,但是我没有输出


命令:
git-config-credential.helper“netrc-d-v”
。输出如下:


首先,您需要确保在会话中实际定义了
主页。
当然,请关闭
cmd
shell,重新打开它,然后键入set HOME以查看它是否引用了正确的文件夹

其次,您需要检查是否已激活:

  • 将文件复制到%PATH%中的任何位置
  • 加:

    cd yourRepo
    git config credential.helper "netrc -d -v"
    
(查找密码时,
-d
-v
将显示实际使用的密码)

最后,您的远程上游回购应包括您的登录:

git clone https://myLogin@example.com/myRepo

尽量避免使用带有“@”的登录(如电子邮件)或(
%40
)。

您好,谢谢您的回答。我试图按照您的指示进行操作,但无法使用git config完成此步骤。。。。我编辑了我的帖子,写下了我到底做了些什么。@IWillTryToCodeIt尝试引用(我编辑了我的答案)。为什么在显示
%PATH%
时会有这么多空格?问题的快速答案:我只是想让它更可见…编辑。这个命令起作用了,我编辑了我的问题,并发布了一个输出。@IWillTryToCodeIt对于错误消息,您可以按照或。
cd yourRepo
git config credential.helper "netrc -d -v"
git clone https://myLogin@example.com/myRepo