Skip to content

cdk init requires git global configuration #530

@normj

Description

@normj

On my machine I don't have a global git config for username and email because for every repository I create I want to explicitly set whether I'm using my work or personal account. Since I don't have that I get errors when I execute cdk init app --language=typescript

> cdk init app --language=typescript                                                                                                                        
Error: ENOENT: no such file or directory, open 'c:\Users\norm\.aws\config'                                                                                  
    at Object.fs.openSync (fs.js:646:18)                                                                                                                    
    at Object.fs.readFileSync (fs.js:551:33)                                                                                                                
    at Object.readFileSync (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\util.js:97:26)                                  
    at SharedIniFile.loadFile [as ensureFileLoaded] (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\shared_ini.js:19:18)   
    at SharedIniFile.loadProfile [as getProfile] (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\shared_ini.js:52:10)      
    at Config.region (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\node_loader.js:88:34)                                 
    at Config.set (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:448:39)                                        
    at Config.<anonymous> (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:283:12)                                
    at Config.each (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\util.js:485:32)                                         
    at new Config (C:\Users\Norm\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\aws-sdk\lib\config.js:282:19)                                        
default@us-west-2 C:\temp\cdk-test\hello-cdk                                                                                                                
> cdk init app --language=typescript                                                                                                                        
Initializing a new git repository...                                                                                                                        
Applying project template app for typescript                                                                                                                
Executing npm install...                                                                                                                                    
npm notice created a lockfile as package-lock.json. You should commit this file.                                                                            
npm WARN hello-cdk@0.1.0 No repository field.                                                                                                               
npm WARN hello-cdk@0.1.0 No license field.                                                                                                                  
                                                                                                                                                            
warning: LF will be replaced by CRLF in .gitignore.                                                                                                         
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in .npmignore.                                                                                                         
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in README.md.                                                                                                          
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in bin/hello-cdk.ts.                                                                                                   
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in cdk.json.                                                                                                           
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in package-lock.json.                                                                                                  
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in package.json.                                                                                                       
The file will have its original line endings in your working directory.                                                                                     
warning: LF will be replaced by CRLF in tsconfig.json.                                                                                                      
The file will have its original line endings in your working directory.                                                                                     
                                                                                                                                                            
*** Please tell me who you are.                                                                                                                             
                                                                                                                                                            
Run                                                                                                                                                         
                                                                                                                                                            
  git config --global user.email "you@example.com"                                                                                                          
  git config --global user.name "Your Name"                                                                                                                 
                                                                                                                                                            
to set your account's default identity.                                                                                                                     
Omit --global to set the identity only in this repository.                                                                                                  
                                                                                                                                                            
fatal: unable to auto-detect email address (got 'Norm@master-control.(none)')                                                                               
git exited with status 128              

Looks like the project isn't finished creating either because when I run cdk synth I get errors about a missing hello-cdk.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions