简体   繁体   中英

How to give a git repo a name?

I am making a remote repo by using these command

mkdir NewRepo
cd NewRepo
git init

Then I clone this repo to local

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

This worked for me, But I want give the repo a name, do something like everybody else does:

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

Is there anyone who can tell me how to do this?

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); ie, 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

名称由目录给出,如上所述,尽管它确实支持对 gitweb 等软件的描述

echo "Happy description" >.git/description

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, eg "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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM