Question

I would like to push my project to Google Code.

I created a new project, in tab Source I have got few instructions how to push my local code.

I work on Windows 7, so I created a directory

C:\googlecode

and I put there file

_netrc

and inside

machine code.google.com login myloginhere@gmail.com password MySecretCodeHere

After that I added new System Variable(sorry, I use non-english version of Windows)

HOME

System Variables

I clicked OK, OK.

Following the instructions, I cloned this repo:

git clone https://path/to/repo

I added a new file README

touch README
git add *
git commit -m "README"
git push origin master

and here I got an error:

fatal: remote error: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.goo
gle.com/hosting/settings

What more I should do to make it works?


I restarted my computer and I run command SET HOME

HOME

I copied git-credential-netrc file to driectory;

C:\Users\Aleksander\Documents\googlemagic

Checked:

enter image description here

Then, I went to diectory with my repo and I run a command

git config credential.helper netrc -d -v

It printed an output:

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

I was trying to modify this command line but without any result. I tried to add

'$shortname -f netrc'

or change options -d -v but then, I have no output.


Command: git config credential.helper "netrc -d -v" worked. Output below:

enter image description here

Était-ce utile?

La solution

First, you need to make sure HOME is actually defined in your session.
To be sure, close your cmd shell, reopen it and type set HOME to see it does reference the right folder.

Second, you need to check that the credential helper netrc is activated:

  • copy the git-credential-netrc file anywhere in your %PATH%
  • add:

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

(the -d and -v will show you what is actually used when looking for your password)

Finally, your remote upstream repo should include your login in it:

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

Try to avoid a login with a '@' in it (like an email), or you would need to encode that '@' sign (%40).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top