How to give a git repo a name?

后端 未结 3 2032
粉色の甜心
粉色の甜心 2021-02-19 21:35

I am making a remote repo by using these command

mkdir NewRepo
cd NewRepo
git init

Then I clone this rep

相关标签:
3条回答
  • 2021-02-19 22:00

    It is possible to create a git repository directly in a folder, without the subdirectory .git. To do this, you do this:

    mkdir myrepo.git
    cd myrepo.git
    git init --bare
    

    This is called a bare repository - it contains the contents of what would normally be in a .git folder. It has no working copy. These sorts of repositories are usually used in the remote server (where you're pushing your changes); i.e., when your remote repository basically reflects what you've committed locally, and nobody is working directly on the code in the remote server location (therefore no need for a working copy.)

    More detail:

    1. Use in distributed workflows.
    2. setting up a public repository
    0 讨论(0)
  • 2021-02-19 22:02

    The name is given by the directory, as mentioned above, though it does support given a description for software like gitweb:

    echo "Happy description" >.git/description
    
    0 讨论(0)
  • 2021-02-19 22:06

    Repositories don't have names, you just use the folder name (I suppose you could name the folder "app.git":

    git clone user@server:/path/to/app
    

    Remotes do have names, e.g. "origin" or whatever you like. This is up to the client though, not a property of the remote repository.

    git remote add origin user@server:/path/to/app
    
    0 讨论(0)
提交回复
热议问题