2014-03-18 33 views
1

我想将我的项目推送至Google代码。如何在Windows 7上配置GIT以将项目推送至Google代码

我创建了一个新的项目,在选项卡中我有几个说明如何推我的本地代码。

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

C:\googlecode 

,我把有文件

_netrc 

和内部

machine code.google.com login [email protected] password MySecretCodeHere 

从那以后,我增加了新的系统变量(对不起,我用的是非英文版的Windows)

HOME 

System Variables

我点击OK,OK。

依照指示操作,我克隆此回购:

git clone https://path/to/repo 

我添加了一个新的README文件

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

HOME

我复制git-credential-netrc文件driectory;

C:\Users\Aleksander\Documents\googlemagic 

经过:

enter image description here

然后,我去我的回购协议diectory和我运行一个命令

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 

我试图修改这个命令行,但没有任何结果。我尝试添加

'$shortname -f netrc' 

或更改选项-d -v但后来,我也没有输出。


命令:git config credential.helper "netrc -d -v"工作。下面的输出:

enter image description here

回答

1

首先,你需要确保HOME在会话实际上定义。
可以肯定的是,请关闭您的cmd外壳,重新打开它并键入set HOME以查看它是否引用正确的文件夹。

其次,你需要检查credential helper netrc被激活:

  • 任何地方复制git-credential-netrc文件在您%PATH%
  • 地址:

    cd yourRepo 
    git config credential.helper "netrc -d -v" 
    

(中-d-v会告诉你在找你时实际使用的是什么[R密码)

最后,远程上游回购应该包括你的登录界面,在它:

git clone https://[email protected]/myRepo 

尽量避免与它“@”登录(如电子邮件),或you would need to encode that '@' sign%40) 。

+0

嗨,谢谢你的回答。我试图按照你的指示,但我无法用* git config ... *来完成步骤。我编辑了我的帖子,我写了,我做了什么。 – ruhungry

+0

@IWillTryToCode它尝试引用(我编辑了我的答案)。为什么显示'%PATH%'时有太多空格? – VonC

+0

快速回答您的问题:我只是想让它更清晰可见......已编辑。 – ruhungry

相关问题